login-username.ftl 5.5 KB

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