Skip to content

Commit

Permalink
Port required changes for reCAPTCHA to the new login theme (keycloak#…
Browse files Browse the repository at this point in the history
…35474)

Closes keycloak#35232

Signed-off-by: Christian Janker <[email protected]>
  • Loading branch information
yanxch authored Dec 2, 2024
1 parent 32a2d30 commit 1d7f07f
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions themes/src/main/resources/theme/keycloak.v2/login/register.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,32 @@

<@registerCommons.termsAcceptance/>

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

<div id="kc-form-buttons" class="${properties.kcFormButtonsClass!}">
<input class="${properties.kcButtonClass!} ${properties.kcButtonPrimaryClass!} ${properties.kcButtonBlockClass!} ${properties.kcButtonLargeClass!}" type="submit" value="${msg("doRegister")}"/>
</div>
<#if recaptchaRequired?? && !(recaptchaVisible!false)>
<script>
function onSubmitRecaptcha(token) {
document.getElementById("kc-register-form").requestSubmit();
}
</script>
<div id="kc-form-buttons" class="${properties.kcFormButtonsClass!}">
<button class="${properties.kcButtonClass!} ${properties.kcButtonPrimaryClass!} ${properties.kcButtonBlockClass!} ${properties.kcButtonLargeClass!} g-recaptcha"
data-sitekey="${recaptchaSiteKey}" data-callback="onSubmitRecaptcha" data-action="${recaptchaAction}" type="submit">
${msg("doRegister")}
</button>
</div>
<#else>
<div id="kc-form-buttons" class="${properties.kcFormButtonsClass!}">
<input class="${properties.kcButtonClass!} ${properties.kcButtonPrimaryClass!} ${properties.kcButtonBlockClass!} ${properties.kcButtonLargeClass!}" type="submit" value="${msg("doRegister")}"/>
</div>
</#if>

<div class="${properties.kcFormGroupClass!} pf-v5-c-login__main-footer-band">
<div id="kc-form-options" class="${properties.kcFormOptionsClass!} pf-v5-c-login__main-footer-band-item">
<div class="${properties.kcFormOptionsWrapperClass!}">
Expand Down

0 comments on commit 1d7f07f

Please sign in to comment.