login.ftl 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name='viewport' content='width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no' />
  6. <title>${realm.displayName}</title>
  7. <style>
  8. * {
  9. margin: 0;
  10. padding: 0;
  11. }
  12. html,
  13. body {
  14. width: 100%;
  15. height: 100%;
  16. }
  17. body {
  18. box-sizing: border-box;
  19. -moz-osx-font-smoothing: grayscale;
  20. -webkit-font-smoothing: antialiased;
  21. text-rendering: optimizeLegibility;
  22. font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
  23. background-color: #F4F7FB;
  24. }
  25. *,
  26. *::before,
  27. *::after {
  28. box-sizing: inherit;
  29. }
  30. a {
  31. border: none;
  32. outline: none;
  33. text-decoration: none;
  34. -webkit-touch-callout: none;
  35. -webkit-tap-highlight-color: transparent;
  36. }
  37. .c-login {
  38. display: flex;
  39. min-height: 100%;
  40. width: 100%;
  41. }
  42. .c-login__img {
  43. flex: 1 0 400px;
  44. display: inline-block;
  45. max-width: 800px;
  46. background: url("${url.resourcesPath}/img/illustration.png") 50% 50% / 757px 613px no-repeat;
  47. }
  48. .c-login__main {
  49. flex: 1 0 auto;
  50. }
  51. @media screen and (max-width: 900px) {
  52. .c-login__img {
  53. display: none;
  54. }
  55. }
  56. .c-login-form {
  57. display: inline-flex;
  58. flex-direction: column;
  59. justify-content: center;
  60. align-items: center;
  61. padding: 40px 0 80px;
  62. background-color: #FFFFFF;
  63. overflow: auto;
  64. }
  65. .c-login-form__header {
  66. display: inline-flex;
  67. align-items: center;
  68. }
  69. .c-login-form__logo {
  70. flex: none;
  71. }
  72. .c-login-form__name {
  73. margin-left: 16px;
  74. color: #1C5CB0;
  75. font-size: 28px;
  76. font-weight: bold;
  77. line-height: 1;
  78. }
  79. .c-login-form__tip {
  80. padding: 20px;
  81. height: 100px;
  82. }
  83. .c-login-form__tip .success {
  84. color: #67C23A;
  85. }
  86. .c-login-form__tip .warning {
  87. color: #E6A23C;
  88. }
  89. .c-login-form__tip .error {
  90. color: #F56C6C;
  91. }
  92. .c-login-form__tip .info {
  93. color: #409EFF;
  94. }
  95. .c-login-form__wrapper {
  96. display: inline-flex;
  97. flex-direction: column;
  98. color: #C4C4C4;
  99. }
  100. .c-login-form__error {
  101. height: 30px;
  102. color: #F56C6C;
  103. font-size: 12px;
  104. line-height: 24px;
  105. white-space: nowrap;
  106. }
  107. .c-login-form__label {
  108. font-size: 24px;
  109. line-height: 1;
  110. }
  111. .c-login-form__section {
  112. display: inline-flex;
  113. align-items: center;
  114. padding: 8px 0 2px;
  115. border-bottom: 1px solid currentColor;
  116. }
  117. .c-login-form__input {
  118. width: 320px;
  119. height: 30px;
  120. font-size: 18px;
  121. line-height: 30px;
  122. border: none;
  123. outline: none;
  124. }
  125. .c-login-form__input.password {
  126. -webkit-text-security: disc;
  127. }
  128. .c-login-form__icon {
  129. display: inline-block;
  130. margin-left: 10px;
  131. width: 30px;
  132. height: 30px;
  133. background-position: 0 0;
  134. background-size: 100% 100%;
  135. background-repeat: no-repeat;
  136. }
  137. .c-login-form__icon.user {
  138. background-image: url("${url.resourcesPath}/img/icon_user.png");
  139. }
  140. .c-login-form__icon.lock {
  141. background-image: url("${url.resourcesPath}/img/icon_lock.png");
  142. }
  143. .c-login-form__submit {
  144. display: inline-flex;
  145. justify-content: center;
  146. align-items: center;
  147. width: 360px;
  148. height: 40px;
  149. margin-top: 50px;
  150. color: #ffffff;
  151. font-size: 18px;
  152. border: none;
  153. background-color: #1C5CB0;
  154. border-radius: 8px;
  155. cursor: pointer;
  156. }
  157. .c-login-form__submit[disabled] {
  158. background-color: #C4C4C4;
  159. }
  160. </style>
  161. </head>
  162. <body>
  163. <div class="c-login">
  164. <div class="c-login__img"></div>
  165. <form
  166. id="loginForm"
  167. class="c-login__main c-login-form"
  168. action="${url.loginAction}"
  169. method="post"
  170. onsubmit="login.disabled = true; return false;"
  171. >
  172. <div class="c-login-form__header">
  173. <img class="c-login-form__logo" src="${url.resourcesPath}/img/logo/${realm.displayNameHtml!'inspur.png'}">
  174. <div class="c-login-form__name">${realm.displayName}</div>
  175. </div>
  176. <div class="c-login-form__tip">
  177. <#if !messagesPerField.existsError('username','password') && message?has_content && !isAppInitiatedAction??>
  178. <span class="${message.type}">${kcSanitize(message.summary)?no_esc}</span>
  179. </#if>
  180. </div>
  181. <div class="c-login-form__wrapper">
  182. <label class="c-login-for__label">用户名</label>
  183. <div class="c-login-form__section">
  184. <input
  185. id="usernameProxy"
  186. type="text"
  187. class="c-login-form__input"
  188. value="${(login.username!'')}"
  189. autocomplete="off"
  190. >
  191. <i class="c-login-form__icon user"></i>
  192. </div>
  193. <div class="c-login-form__error">
  194. <#if messagesPerField.existsError('username','password')>
  195. ${kcSanitize(messagesPerField.getFirstError('username','password'))?no_esc}
  196. </#if>
  197. </div>
  198. </div>
  199. <div class="c-login-form__wrapper">
  200. <label class="c-login-for__label">密码</label>
  201. <div class="c-login-form__section">
  202. <input
  203. id="passwordProxy"
  204. type="password"
  205. class="c-login-form__input"
  206. autocomplete="off"
  207. aria-autocomplete="none"
  208. >
  209. <i class="c-login-form__icon lock"></i>
  210. </div>
  211. <div class="c-login-form__error"></div>
  212. </div>
  213. <input id="username" name="username" hidden >
  214. <input id="password" name="password" hidden >
  215. <button
  216. class="c-login-form__submit"
  217. name="login"
  218. onclick="onSubmit()"
  219. >
  220. 登 录
  221. </button>
  222. </form>
  223. </div>
  224. <script src="${url.resourcesPath}/js/md5.js"></script>
  225. <script>
  226. function onSubmit () {
  227. var form = document.getElementById('loginForm')
  228. document.getElementById('username').value = document.getElementById('usernameProxy').value
  229. document.getElementById('password').value = MD5Salt(document.getElementById('passwordProxy').value)
  230. form.submit()
  231. }
  232. </script>
  233. </body>
  234. </html>