login-otp.ftl 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <#import "template.ftl" as layout>
  2. <@layout.registrationLayout displayMessage=!messagesPerField.existsError('totp'); section>
  3. <#if section="header">
  4. ${msg("doLogIn")}
  5. <#elseif section="form">
  6. <form id="kc-otp-login-form" class="${properties.kcFormClass!}" action="${url.loginAction}"
  7. method="post">
  8. <#if otpLogin.userOtpCredentials?size gt 1>
  9. <div class="${properties.kcFormGroupClass!}">
  10. <div class="${properties.kcInputWrapperClass!}">
  11. <#list otpLogin.userOtpCredentials as otpCredential>
  12. <input id="kc-otp-credential-${otpCredential?index}" class="${properties.kcLoginOTPListInputClass!}" type="radio" name="selectedCredentialId" value="${otpCredential.id}" <#if otpCredential.id == otpLogin.selectedCredentialId>checked="checked"</#if>>
  13. <label for="kc-otp-credential-${otpCredential?index}" class="${properties.kcLoginOTPListClass!}" tabindex="${otpCredential?index}">
  14. <span class="${properties.kcLoginOTPListItemHeaderClass!}">
  15. <span class="${properties.kcLoginOTPListItemIconBodyClass!}">
  16. <i class="${properties.kcLoginOTPListItemIconClass!}" aria-hidden="true"></i>
  17. </span>
  18. <span class="${properties.kcLoginOTPListItemTitleClass!}">${otpCredential.userLabel}</span>
  19. </span>
  20. </label>
  21. </#list>
  22. </div>
  23. </div>
  24. </#if>
  25. <div class="${properties.kcFormGroupClass!}">
  26. <div class="${properties.kcLabelWrapperClass!}">
  27. <label for="otp" class="${properties.kcLabelClass!}">${msg("loginOtpOneTime")}</label>
  28. </div>
  29. <div class="${properties.kcInputWrapperClass!}">
  30. <input id="otp" name="otp" autocomplete="off" type="text" class="${properties.kcInputClass!}"
  31. autofocus aria-invalid="<#if messagesPerField.existsError('totp')>true</#if>"/>
  32. <#if messagesPerField.existsError('totp')>
  33. <span id="input-error-otp-code" class="${properties.kcInputErrorMessageClass!}"
  34. aria-live="polite">
  35. ${kcSanitize(messagesPerField.get('totp'))?no_esc}
  36. </span>
  37. </#if>
  38. </div>
  39. </div>
  40. <div class="${properties.kcFormGroupClass!}">
  41. <div id="kc-form-options" class="${properties.kcFormOptionsClass!}">
  42. <div class="${properties.kcFormOptionsWrapperClass!}">
  43. </div>
  44. </div>
  45. <div id="kc-form-buttons" class="${properties.kcFormButtonsClass!}">
  46. <input
  47. class="${properties.kcButtonClass!} ${properties.kcButtonPrimaryClass!} ${properties.kcButtonBlockClass!} ${properties.kcButtonLargeClass!}"
  48. name="login" id="kc-login" type="submit" value="${msg("doLogIn")}" />
  49. </div>
  50. </div>
  51. </form>
  52. </#if>
  53. </@layout.registrationLayout>