login.ftl 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <#import "template.ftl" as layout>
  2. <@layout.registrationLayout displayMessage=!messagesPerField.existsError('username','password') displayInfo=realm.password && realm.registrationAllowed && !registrationDisabled??; section>
  3. <#if section = "header">
  4. ${msg("loginAccountTitle")}
  5. <#elseif section = "form">
  6. <div id="kc-form">
  7. <div id="kc-form-wrapper">
  8. <#if realm.password>
  9. <form id="kc-form-login" onsubmit="login.disabled = true; return true;" action="${url.loginAction}" method="post">
  10. <div class="${properties.kcFormGroupClass!}">
  11. <label for="username" class="${properties.kcLabelClass!}"><#if !realm.loginWithEmailAllowed>${msg("username")}<#elseif !realm.registrationEmailAsUsername>${msg("usernameOrEmail")}<#else>${msg("email")}</#if></label>
  12. <#if usernameEditDisabled??>
  13. <input tabindex="1" id="username" class="${properties.kcInputClass!}" name="username" value="${(login.username!'')}" type="text" disabled />
  14. <#else>
  15. <input tabindex="1" id="username" class="${properties.kcInputClass!}" name="username" value="${(login.username!'')}" type="text" autofocus autocomplete="off"
  16. aria-invalid="<#if messagesPerField.existsError('username','password')>true</#if>"
  17. />
  18. <#if messagesPerField.existsError('username','password')>
  19. <span id="input-error" class="${properties.kcInputErrorMessageClass!}" aria-live="polite">
  20. ${kcSanitize(messagesPerField.getFirstError('username','password'))?no_esc}
  21. </span>
  22. </#if>
  23. </#if>
  24. </div>
  25. <div class="${properties.kcFormGroupClass!}">
  26. <label for="password" class="${properties.kcLabelClass!}">${msg("password")}</label>
  27. <input tabindex="2" id="password" class="${properties.kcInputClass!}" name="password" type="password" autocomplete="off"
  28. aria-invalid="<#if messagesPerField.existsError('username','password')>true</#if>"
  29. />
  30. </div>
  31. <div class="${properties.kcFormGroupClass!} ${properties.kcFormSettingClass!}">
  32. <div id="kc-form-options">
  33. <#if realm.rememberMe && !usernameEditDisabled??>
  34. <div class="checkbox">
  35. <label>
  36. <#if login.rememberMe??>
  37. <input tabindex="3" id="rememberMe" name="rememberMe" type="checkbox" checked> ${msg("rememberMe")}
  38. <#else>
  39. <input tabindex="3" id="rememberMe" name="rememberMe" type="checkbox"> ${msg("rememberMe")}
  40. </#if>
  41. </label>
  42. </div>
  43. </#if>
  44. </div>
  45. <div class="${properties.kcFormOptionsWrapperClass!}">
  46. <#if realm.resetPasswordAllowed>
  47. <span><a tabindex="5" href="${url.loginResetCredentialsUrl}">${msg("doForgotPassword")}</a></span>
  48. </#if>
  49. </div>
  50. </div>
  51. <div id="kc-form-buttons" class="${properties.kcFormGroupClass!}">
  52. <input type="hidden" id="id-hidden-input" name="credentialId" <#if auth.selectedCredential?has_content>value="${auth.selectedCredential}"</#if>/>
  53. <input tabindex="4" class="${properties.kcButtonClass!} ${properties.kcButtonPrimaryClass!} ${properties.kcButtonBlockClass!} ${properties.kcButtonLargeClass!}" name="login" id="kc-login" type="submit" value="${msg("doLogIn")}"/>
  54. </div>
  55. </form>
  56. </#if>
  57. </div>
  58. <#if realm.password && social.providers??>
  59. <div id="kc-social-providers" class="${properties.kcFormSocialAccountSectionClass!}">
  60. <hr/>
  61. <h4>${msg("identity-provider-login-label")}</h4>
  62. <ul class="${properties.kcFormSocialAccountListClass!} <#if social.providers?size gt 3>${properties.kcFormSocialAccountListGridClass!}</#if>">
  63. <#list social.providers as p>
  64. <a id="social-${p.alias}" class="${properties.kcFormSocialAccountListButtonClass!} <#if social.providers?size gt 3>${properties.kcFormSocialAccountGridItem!}</#if>"
  65. type="button" href="${p.loginUrl}">
  66. <#if p.iconClasses?has_content>
  67. <i class="${properties.kcCommonLogoIdP!} ${p.iconClasses!}" aria-hidden="true"></i>
  68. <span class="${properties.kcFormSocialAccountNameClass!} kc-social-icon-text">${p.displayName!}</span>
  69. <#else>
  70. <span class="${properties.kcFormSocialAccountNameClass!}">${p.displayName!}</span>
  71. </#if>
  72. </a>
  73. </#list>
  74. </ul>
  75. </div>
  76. </#if>
  77. </div>
  78. <#elseif section = "info" >
  79. <#if realm.password && realm.registrationAllowed && !registrationDisabled??>
  80. <div id="kc-registration-container">
  81. <div id="kc-registration">
  82. <span>${msg("noAccount")} <a tabindex="6"
  83. href="${url.registrationUrl}">${msg("doRegister")}</a></span>
  84. </div>
  85. </div>
  86. </#if>
  87. </#if>
  88. </@layout.registrationLayout>