raptor-group / keycloak-login-recaptcha

By default Keycloak (up to 12) only supports ReCaptcha for Regsitration, not login. so we created a simple module for activating recaptcha for login
Apache License 2.0
72 stars 37 forks source link

keycloak-login-recaptcha

By default Keycloak (up to 12) only supports ReCaptcha for Registration, not login. so we created a simple module for activating recaptcha for login

How to use

Explaination

Inside the login.ftl, We have just added this part inside <form></form> section. So inside RecaptchaUsernamePasswordForm we will set recaptchaRequired to true, and this part of login.ftl will be enabled for recaptcha based logins. If using normal UsernamePasswordForm then this part will not be enabled in the login form.

<#if recaptchaRequired??>
    <div class="form-group">
        <div class="${properties.kcInputWrapperClass!}">
            <div class="g-recaptcha" data-size="compact" data-sitekey="${recaptchaSiteKey}"></div>
        </div>
    </div>
</#if>