login.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. {{template "head" .}}
  4. <style>
  5. html * {
  6. -webkit-font-smoothing: antialiased;
  7. -moz-osx-font-smoothing: grayscale;
  8. }
  9. h1 {
  10. text-align: center;
  11. /* margin: 20px 0 50px 0;*/
  12. height: 110px;
  13. }
  14. .ant-btn,
  15. .ant-input {
  16. height: 50px;
  17. border-radius: 30px;
  18. }
  19. .ant-input-group-addon {
  20. border-radius: 0 30px 30px 0;
  21. width: 50px;
  22. font-size: 18px;
  23. }
  24. .ant-input-affix-wrapper .ant-input-prefix {
  25. left: 23px;
  26. }
  27. .ant-input-affix-wrapper .ant-input:not(:first-child) {
  28. padding-left: 50px;
  29. }
  30. .centered {
  31. display: flex;
  32. text-align: center;
  33. align-items: center;
  34. justify-content: center;
  35. width: 100%;
  36. }
  37. .title {
  38. font-size: 32px;
  39. }
  40. .title b {
  41. font-weight: bold !important;
  42. }
  43. #app {
  44. overflow: hidden;
  45. }
  46. #login {
  47. animation: charge 0.5s both;
  48. background-color: #fff;
  49. border-radius: 2rem;
  50. padding: 3rem;
  51. transition: all 0.3s;
  52. user-select: none;
  53. -webkit-user-select: none;
  54. -moz-user-select: none;
  55. }
  56. #login:hover {
  57. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
  58. }
  59. @keyframes charge {
  60. from {
  61. transform: translateY(5rem);
  62. opacity: 0;
  63. }
  64. to {
  65. transform: translateY(0);
  66. opacity: 1;
  67. }
  68. }
  69. .under {
  70. background-color: #c7ebe2;
  71. z-index: 0;
  72. }
  73. .dark .under {
  74. background-color: var(--dark-color-login-wave);
  75. }
  76. .dark #login {
  77. background-color: var(--dark-color-surface-100);
  78. }
  79. .dark h1 {
  80. color: rgba(255, 255, 255);
  81. }
  82. .ant-btn-primary-login {
  83. width: 100%;
  84. }
  85. .ant-btn-primary-login:focus,
  86. .ant-btn-primary-login:hover {
  87. color: #fff;
  88. background-color: #006655;
  89. border-color: #006655;
  90. background-image: linear-gradient(270deg,
  91. rgba(123, 199, 77, 0) 30%,
  92. #009980,
  93. rgba(123, 199, 77, 0) 100%);
  94. background-repeat: no-repeat;
  95. animation: ma-bg-move ease-in-out 5s infinite;
  96. background-position-x: -500px;
  97. width: 95%;
  98. animation-delay: -0.5s;
  99. box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);
  100. }
  101. .ant-btn-primary-login.active,
  102. .ant-btn-primary-login:active {
  103. color: #fff;
  104. background-color: #006655;
  105. border-color: #006655;
  106. }
  107. @keyframes ma-bg-move {
  108. 0% {
  109. background-position: -500px 0;
  110. }
  111. 50% {
  112. background-position: 1000px 0;
  113. }
  114. 100% {
  115. background-position: 1000px 0;
  116. }
  117. }
  118. .wave-btn-bg {
  119. position: relative;
  120. border-radius: 25px;
  121. width: 100%;
  122. transition: all 0.3s cubic-bezier(.645, .045, .355, 1);
  123. }
  124. .dark .wave-btn-bg {
  125. color: #fff;
  126. position: relative;
  127. background-color: #0a7557;
  128. border: 2px double transparent;
  129. background-origin: border-box;
  130. background-clip: padding-box, border-box;
  131. background-size: 300%;
  132. width: 100%;
  133. z-index: 1;
  134. }
  135. .dark .wave-btn-bg:hover {
  136. animation: wave-btn-tara 4s ease infinite;
  137. }
  138. .dark .wave-btn-bg-cl {
  139. background-image: linear-gradient(rgba(13, 14, 33, 0), rgba(13, 14, 33, 0)),
  140. radial-gradient(circle at left top, #006655, #009980, #006655) !important;
  141. border-radius: 3em;
  142. }
  143. .dark .wave-btn-bg-cl:hover {
  144. width: 95%;
  145. }
  146. .dark .wave-btn-bg-cl:before {
  147. position: absolute;
  148. content: "";
  149. top: -5px;
  150. left: -5px;
  151. bottom: -5px;
  152. right: -5px;
  153. z-index: -1;
  154. background: inherit;
  155. background-size: inherit;
  156. border-radius: 4em;
  157. opacity: 0;
  158. transition: 0.5s;
  159. }
  160. .dark .wave-btn-bg-cl:hover::before {
  161. opacity: 1;
  162. filter: blur(20px);
  163. animation: wave-btn-tara 8s linear infinite;
  164. }
  165. @keyframes wave-btn-tara {
  166. to {
  167. background-position: 300%;
  168. }
  169. }
  170. .dark .ant-btn-primary-login {
  171. font-size: 14px;
  172. color: #fff;
  173. text-align: center;
  174. background-image: linear-gradient(rgba(13, 14, 33, 0.45),
  175. rgba(13, 14, 33, 0.35));
  176. border-radius: 2rem;
  177. border: none;
  178. outline: none;
  179. background-color: transparent;
  180. height: 46px;
  181. position: relative;
  182. white-space: nowrap;
  183. cursor: pointer;
  184. touch-action: manipulation;
  185. padding: 0 15px;
  186. width: 100%;
  187. animation: none;
  188. background-position-x: 0;
  189. box-shadow: none;
  190. }
  191. .waves-header {
  192. position: fixed;
  193. width: 100%;
  194. text-align: center;
  195. background-color: #dbf5ed;
  196. color: white;
  197. z-index: -1;
  198. }
  199. .dark .waves-header {
  200. background-color: var(--dark-color-login-background);
  201. }
  202. .waves-inner-header {
  203. height: 50vh;
  204. width: 100%;
  205. margin: 0;
  206. padding: 0;
  207. }
  208. .waves {
  209. position: relative;
  210. width: 100%;
  211. height: 15vh;
  212. margin-bottom: -8px;
  213. /*Fix for safari gap*/
  214. min-height: 100px;
  215. max-height: 150px;
  216. }
  217. .parallax>use {
  218. animation: move-forever 25s cubic-bezier(0.55, 0.5, 0.45, 0.5) infinite;
  219. }
  220. .dark .parallax>use {
  221. fill: var(--dark-color-login-wave);
  222. }
  223. .parallax>use:nth-child(1) {
  224. animation-delay: -2s;
  225. animation-duration: 4s;
  226. opacity: 0.2;
  227. }
  228. .parallax>use:nth-child(2) {
  229. animation-delay: -3s;
  230. animation-duration: 7s;
  231. opacity: 0.4;
  232. }
  233. .parallax>use:nth-child(3) {
  234. animation-delay: -4s;
  235. animation-duration: 10s;
  236. opacity: 0.6;
  237. }
  238. .parallax>use:nth-child(4) {
  239. animation-delay: -5s;
  240. animation-duration: 13s;
  241. }
  242. @keyframes move-forever {
  243. 0% {
  244. transform: translate3d(-90px, 0, 0);
  245. }
  246. 100% {
  247. transform: translate3d(85px, 0, 0);
  248. }
  249. }
  250. @media (max-width: 768px) {
  251. .waves {
  252. height: 40px;
  253. min-height: 40px;
  254. }
  255. }
  256. .words-wrapper {
  257. width: 100%;
  258. display: inline-block;
  259. position: relative;
  260. text-align: center;
  261. }
  262. .words-wrapper b {
  263. width: 100%;
  264. display: inline-block;
  265. position: absolute;
  266. left: 0;
  267. top: 0;
  268. }
  269. .words-wrapper b.is-visible {
  270. position: relative;
  271. }
  272. .headline.zoom .words-wrapper {
  273. -webkit-perspective: 300px;
  274. -moz-perspective: 300px;
  275. perspective: 300px;
  276. }
  277. .headline {
  278. display: flex;
  279. justify-content: center;
  280. align-items: center;
  281. }
  282. .headline.zoom b {
  283. opacity: 0;
  284. }
  285. .headline.zoom b.is-visible {
  286. opacity: 1;
  287. -webkit-animation: zoom-in 0.8s;
  288. -moz-animation: zoom-in 0.8s;
  289. animation: cubic-bezier(0.215, 0.610, 0.355, 1.000) zoom-in 0.8s;
  290. }
  291. .headline.zoom b.is-hidden {
  292. -webkit-animation: zoom-out 0.8s;
  293. -moz-animation: zoom-out 0.8s;
  294. animation: cubic-bezier(0.215, 0.610, 0.355, 1.000) zoom-out 0.4s;
  295. }
  296. @-webkit-keyframes zoom-in {
  297. 0% {
  298. opacity: 0;
  299. -webkit-transform: translateZ(100px);
  300. }
  301. 100% {
  302. opacity: 1;
  303. -webkit-transform: translateZ(0);
  304. }
  305. }
  306. @-moz-keyframes zoom-in {
  307. 0% {
  308. opacity: 0;
  309. -moz-transform: translateZ(100px);
  310. }
  311. 100% {
  312. opacity: 1;
  313. -moz-transform: translateZ(0);
  314. }
  315. }
  316. @keyframes zoom-in {
  317. 0% {
  318. opacity: 0;
  319. -webkit-transform: translateZ(100px);
  320. -moz-transform: translateZ(100px);
  321. -ms-transform: translateZ(100px);
  322. -o-transform: translateZ(100px);
  323. transform: translateZ(100px);
  324. }
  325. 100% {
  326. opacity: 1;
  327. -webkit-transform: translateZ(0);
  328. -moz-transform: translateZ(0);
  329. -ms-transform: translateZ(0);
  330. -o-transform: translateZ(0);
  331. transform: translateZ(0);
  332. }
  333. }
  334. @-webkit-keyframes zoom-out {
  335. 0% {
  336. opacity: 1;
  337. -webkit-transform: translateZ(0);
  338. }
  339. 100% {
  340. opacity: 0;
  341. -webkit-transform: translateZ(-100px);
  342. }
  343. }
  344. @-moz-keyframes zoom-out {
  345. 0% {
  346. opacity: 1;
  347. -moz-transform: translateZ(0);
  348. }
  349. 100% {
  350. opacity: 0;
  351. -moz-transform: translateZ(-100px);
  352. }
  353. }
  354. @keyframes zoom-out {
  355. 0% {
  356. opacity: 1;
  357. -webkit-transform: translateZ(0);
  358. -moz-transform: translateZ(0);
  359. -ms-transform: translateZ(0);
  360. -o-transform: translateZ(0);
  361. transform: translateZ(0);
  362. }
  363. 100% {
  364. opacity: 0;
  365. -webkit-transform: translateZ(-100px);
  366. -moz-transform: translateZ(-100px);
  367. -ms-transform: translateZ(-100px);
  368. -o-transform: translateZ(-100px);
  369. transform: translateZ(-100px);
  370. }
  371. }
  372. .setting-section {
  373. position: absolute;
  374. top: 0;
  375. right: 0;
  376. padding: 24px;
  377. }
  378. .setting-section > .ant-btn {
  379. width: 36px;
  380. height: 36px;
  381. }
  382. </style>
  383. <body>
  384. <a-layout id="app" v-cloak :class="themeSwitcher.currentTheme">
  385. <transition name="list" appear>
  386. <a-layout-content class="under" :style="{ minHeight: '0' }">
  387. <div class="waves-header">
  388. <div class="waves-inner-header"></div>
  389. <svg class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
  390. viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto">
  391. <defs>
  392. <path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z" />
  393. </defs>
  394. <g class="parallax">
  395. <use xlink:href="#gentle-wave" x="48" y="0" fill="rgba(0, 135, 113, 0.08)" />
  396. <use xlink:href="#gentle-wave" x="48" y="3" fill="rgba(0, 135, 113, 0.08)" />
  397. <use xlink:href="#gentle-wave" x="48" y="5" fill="rgba(0, 135, 113, 0.08)" />
  398. <use xlink:href="#gentle-wave" x="48" y="7" fill="#c7ebe2" />
  399. </g>
  400. </svg>
  401. </div>
  402. <div class="setting-section">
  403. <a-popover :overlay-class-name="themeSwitcher.currentTheme" title='{{ i18n "menu.settings" }}' placement="bottomRight" trigger="click">
  404. <template slot="content">
  405. <a-space direction="vertical" :size="10">
  406. <a-theme-switch-login></a-theme-switch-login>
  407. <span>{{ i18n "pages.settings.language" }}</span>
  408. <a-select ref="selectLang" :style="{ width: '100%' }" v-model="lang" @change="LanguageManager.setLanguage(lang)" :dropdown-class-name="themeSwitcher.currentTheme">
  409. <a-select-option :value="l.value" label="English" v-for="l in LanguageManager.supportedLanguages">
  410. <span role="img" aria-label="l.name" v-text="l.icon"></span>
  411. &nbsp;&nbsp;<span v-text="l.name"></span>
  412. </a-select-option>
  413. </a-select>
  414. </a-space>
  415. </template>
  416. <a-button shape="circle" icon="setting"></a-button>
  417. </a-popover>
  418. </div>
  419. <a-row type="flex" justify="center" align="middle" :style="{ height: '100%', overflow: 'auto', overflowX: 'hidden' }">
  420. <a-col :xs="22" :sm="20" :md="14" :lg="10" :xl="8" :xxl="6" id="login" :style="{ margin: '3rem 0' }">
  421. <a-row type="flex" justify="center">
  422. <a-col :style="{ width: '100%' }">
  423. <h2 class="title headline zoom">
  424. <span class="words-wrapper">
  425. <b class="is-visible">{{ i18n "pages.login.hello" }}</b>
  426. <b>{{ i18n "pages.login.title" }}</b>
  427. </span>
  428. </h2>
  429. </a-col>
  430. </a-row>
  431. <a-row type="flex" justify="center">
  432. <a-col span="24">
  433. <a-form>
  434. <a-space direction="vertical" size="middle">
  435. <a-form-item>
  436. <a-input autocomplete="username" name="username" v-model.trim="user.username"
  437. placeholder='{{ i18n "username" }}' @keydown.enter.native="login" autofocus>
  438. <a-icon slot="prefix" type="user" :style="{ fontSize: '16px' }"></a-icon>
  439. </a-input>
  440. </a-form-item>
  441. <a-form-item>
  442. <a-input-password autocomplete="password" name="password" icon="lock" v-model.trim="user.password"
  443. placeholder='{{ i18n "password" }}' @keydown.enter.native="login">
  444. <a-icon slot="prefix" type="lock" :style="{ fontSize: '16px' }"></a-icon>
  445. </a-input-password>
  446. </a-form-item>
  447. <a-form-item v-if="secretEnable">
  448. <a-input-password autocomplete="secret" name="secret" icon="lock" v-model.trim="user.loginSecret"
  449. placeholder='{{ i18n "secretToken" }}' @keydown.enter.native="login">
  450. <a-icon slot="prefix" type="key" :style="{ fontSize: '16px' }"></a-icon>
  451. </a-input-password>
  452. </a-form-item>
  453. <a-form-item>
  454. <a-row justify="center" class="centered">
  455. <div :style="{ height: '50px', marginTop: '16px' }" class="wave-btn-bg wave-btn-bg-cl"
  456. :style="loading ? { width: '52px' } : { display: 'inline-block' }">
  457. <a-button class="ant-btn-primary-login" type="primary" :loading="loading" @click="login"
  458. :icon="loading ? 'poweroff' : undefined">
  459. [[ loading ? '' : '{{ i18n "login" }}' ]]
  460. </a-button>
  461. </div>
  462. </a-row>
  463. </a-form-item>
  464. </a-space>
  465. </a-form>
  466. </a-col>
  467. </a-row>
  468. </a-col>
  469. </a-row>
  470. </a-layout-content>
  471. </transition>
  472. </a-layout>
  473. {{template "js" .}}
  474. {{template "component/aThemeSwitch" .}}
  475. <script>
  476. const app = new Vue({
  477. delimiters: ['[[', ']]'],
  478. el: '#app',
  479. data: {
  480. themeSwitcher,
  481. loading: false,
  482. user: {
  483. username: "",
  484. password: "",
  485. loginSecret: ""
  486. },
  487. secretEnable: false,
  488. lang: ""
  489. },
  490. async mounted() {
  491. this.lang = LanguageManager.getLanguage();
  492. this.secretEnable = await this.getSecretStatus();
  493. },
  494. methods: {
  495. async login() {
  496. this.loading = true;
  497. const msg = await HttpUtil.post('/login', this.user);
  498. this.loading = false;
  499. if (msg.success) {
  500. location.href = basePath + 'panel/';
  501. }
  502. },
  503. async getSecretStatus() {
  504. this.loading = true;
  505. const msg = await HttpUtil.post('/getSecretStatus');
  506. this.loading = false;
  507. if (msg.success) {
  508. this.secretEnable = msg.obj;
  509. return msg.obj;
  510. }
  511. },
  512. },
  513. });
  514. document.addEventListener("DOMContentLoaded", function () {
  515. var animationDelay = 2000;
  516. initHeadline();
  517. function initHeadline() {
  518. animateHeadline(document.querySelectorAll('.headline'));
  519. }
  520. function animateHeadline(headlines) {
  521. var duration = animationDelay;
  522. headlines.forEach(function (headline) {
  523. setTimeout(function () {
  524. hideWord(headline.querySelector('.is-visible'));
  525. }, duration);
  526. });
  527. }
  528. function hideWord(word) {
  529. var nextWord = takeNext(word);
  530. switchWord(word, nextWord);
  531. setTimeout(function () {
  532. hideWord(nextWord);
  533. }, animationDelay);
  534. }
  535. function takeNext(word) {
  536. return word.nextElementSibling ? word.nextElementSibling : word.parentElement.firstElementChild;
  537. }
  538. function switchWord(oldWord, newWord) {
  539. oldWord.classList.remove('is-visible');
  540. oldWord.classList.add('is-hidden');
  541. newWord.classList.remove('is-hidden');
  542. newWord.classList.add('is-visible');
  543. }
  544. });
  545. </script>
  546. </body>
  547. </html>