login.html 15 KB

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