login.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. {{template "head" .}}
  4. <style>
  5. h1 {
  6. text-align: center;
  7. margin: 20px 0 50px 0;
  8. }
  9. .ant-btn,
  10. .ant-input {
  11. height: 50px;
  12. border-radius: 30px;
  13. }
  14. .ant-input-group-addon {
  15. border-radius: 0 30px 30px 0;
  16. width: 50px;
  17. font-size: 18px;
  18. }
  19. .ant-input-affix-wrapper .ant-input-prefix {
  20. left: 23px;
  21. }
  22. .ant-input-affix-wrapper .ant-input:not(:first-child) {
  23. padding-left: 50px;
  24. }
  25. .centered {
  26. display: flex;
  27. text-align: center;
  28. align-items: center;
  29. justify-content: center;
  30. width: 100%;
  31. }
  32. .title {
  33. font-size: 32px;
  34. font-weight: bold;
  35. }
  36. #app {
  37. overflow: hidden;
  38. }
  39. #login {
  40. animation: charge 0.5s both;
  41. background-color: #fff;
  42. border-radius: 2rem;
  43. padding: 3rem;
  44. transition: all 0.3s;
  45. }
  46. #login:hover {
  47. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
  48. }
  49. @keyframes charge {
  50. from {
  51. transform: translateY(5rem);
  52. opacity: 0;
  53. }
  54. to {
  55. transform: translateY(0);
  56. opacity: 1;
  57. }
  58. }
  59. .under {
  60. background-color: #c7ebe2;
  61. z-index: 0;
  62. }
  63. .dark .under {
  64. background-color: #0f2d32;
  65. }
  66. .dark #login {
  67. background-color: #151f31;
  68. }
  69. .dark h1 {
  70. color: rgba(255, 255, 255, 0.85);
  71. }
  72. .ant-form-item {
  73. margin-bottom: 16px;
  74. }
  75. .ant-btn-primary-login {
  76. width: 100%;
  77. }
  78. .ant-btn-primary-login:focus,
  79. .ant-btn-primary-login:hover {
  80. color: #fff;
  81. background-color: #006655;
  82. border-color: #006655;
  83. background-image: linear-gradient(
  84. 270deg,
  85. rgba(123, 199, 77, 0) 30%,
  86. #009980,
  87. rgba(123, 199, 77, 0) 100%
  88. );
  89. background-repeat: no-repeat;
  90. animation: ma-bg-move ease-in-out 5s infinite;
  91. background-position-x: -500px;
  92. width: 95%;
  93. animation-delay: -0.5s;
  94. box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);
  95. }
  96. .ant-btn-primary-login.active,
  97. .ant-btn-primary-login:active {
  98. color: #fff;
  99. background-color: #006655;
  100. border-color: #006655;
  101. }
  102. @keyframes ma-bg-move {
  103. 0% {
  104. background-position: -500px 0;
  105. }
  106. 50% {
  107. background-position: 1000px 0;
  108. }
  109. 100% {
  110. background-position: 1000px 0;
  111. }
  112. }
  113. .wave-btn-bg {
  114. position: relative;
  115. border-radius: 25px;
  116. width: 100%;
  117. transition: all 0.3s cubic-bezier(.645,.045,.355,1);
  118. }
  119. .dark .wave-btn-bg {
  120. color: #fff;
  121. position: relative;
  122. background-color: #0a7557;
  123. border: 2px double transparent;
  124. background-origin: border-box;
  125. background-clip: padding-box, border-box;
  126. background-size: 300%;
  127. width: 100%;
  128. z-index: 1;
  129. }
  130. .dark .wave-btn-bg:hover {animation: wave-btn-tara 4s ease infinite;}
  131. .dark .wave-btn-bg-cl {
  132. background-image: linear-gradient(rgba(13, 14, 33, 0), rgba(13, 14, 33, 0)),
  133. radial-gradient(circle at left top, #006655, #009980, #006655) !important;
  134. border-radius: 3em;
  135. }
  136. .dark .wave-btn-bg-cl:hover {
  137. width: 95%;
  138. }
  139. .dark .wave-btn-bg-cl:before {
  140. position: absolute;
  141. content: "";
  142. top: -5px;
  143. left: -5px;
  144. bottom: -5px;
  145. right: -5px;
  146. z-index: -1;
  147. background: inherit;
  148. background-size: inherit;
  149. border-radius: 4em;
  150. opacity: 0;
  151. transition: 0.5s;
  152. }
  153. .dark .wave-btn-bg-cl:hover::before {
  154. opacity: 1;
  155. filter: blur(20px);
  156. animation: wave-btn-tara 8s linear infinite;
  157. }
  158. @keyframes wave-btn-tara {
  159. to {
  160. background-position: 300%;
  161. }
  162. }
  163. .dark .ant-btn-primary-login {
  164. font-size: 14px;
  165. color: #fff;
  166. text-align: center;
  167. background-image: linear-gradient(
  168. rgba(13, 14, 33, 0.45),
  169. rgba(13, 14, 33, 0.35)
  170. );
  171. border-radius: 2rem;
  172. border: none;
  173. outline: none;
  174. background-color: transparent;
  175. height: 46px;
  176. position: relative;
  177. white-space: nowrap;
  178. cursor: pointer;
  179. touch-action: manipulation;
  180. padding: 0 15px;
  181. width: 100%;
  182. animation: none;
  183. background-position-x: 0;
  184. box-shadow: none;
  185. }
  186. .waves-header {
  187. position: fixed;
  188. width: 100%;
  189. text-align: center;
  190. background-color: #dbf5ed;
  191. color: white;
  192. z-index: -1;
  193. }
  194. .dark .waves-header {
  195. background-color: #101828;
  196. }
  197. .waves-inner-header {
  198. height: 50vh;
  199. width: 100%;
  200. margin: 0;
  201. padding: 0;
  202. }
  203. .waves {
  204. position: relative;
  205. width: 100%;
  206. height: 15vh;
  207. margin-bottom: -5px; /*Fix for safari gap*/
  208. min-height: 100px;
  209. max-height: 150px;
  210. }
  211. .parallax > use {
  212. animation: move-forever 25s cubic-bezier(0.55, 0.5, 0.45, 0.5) infinite;
  213. }
  214. .dark .parallax > use {
  215. fill: rgb(10 117 87 / 20%);
  216. }
  217. .parallax > use:nth-child(1) {
  218. animation-delay: -2s;
  219. animation-duration: 7s;
  220. opacity: 0.2;
  221. }
  222. .parallax > use:nth-child(2) {
  223. animation-delay: -3s;
  224. animation-duration: 10s;
  225. opacity: 0.4;
  226. }
  227. .parallax > use:nth-child(3) {
  228. animation-delay: -4s;
  229. animation-duration: 13s;
  230. opacity: 0.6;
  231. }
  232. @keyframes move-forever {
  233. 0% {
  234. transform: translate3d(-90px, 0, 0);
  235. }
  236. 100% {
  237. transform: translate3d(85px, 0, 0);
  238. }
  239. }
  240. @media (max-width: 768px) {
  241. .waves {
  242. height: 40px;
  243. min-height: 40px;
  244. }
  245. }
  246. </style>
  247. <body>
  248. <a-layout id="app" v-cloak :class="themeSwitcher.currentTheme">
  249. <transition name="list" appear>
  250. <a-layout-content class="under" style="min-height: 0;">
  251. <div class="waves-header">
  252. <div class="waves-inner-header"></div>
  253. <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">
  254. <defs>
  255. <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" />
  256. </defs>
  257. <g class="parallax">
  258. <use xlink:href="#gentle-wave" x="48" y="3" fill="rgba(0, 135, 113, 0.08)" />
  259. <use xlink:href="#gentle-wave" x="48" y="5" fill="rgba(0, 135, 113, 0.08)" />
  260. <use xlink:href="#gentle-wave" x="48" y="7" fill="rgba(0, 135, 113, 0.08)" />
  261. </g>
  262. </svg>
  263. </div>
  264. <a-row type="flex" justify="center" align="middle" style="height: 100%; overflow: auto;">
  265. <a-col :xs="22" :sm="20" :md="14" :lg="10" :xl="8" :xxl="6" id="login" style="margin: 3rem 0;">
  266. <a-row type="flex" justify="center">
  267. <a-col>
  268. <h1 class="title">{{ i18n "pages.login.title" }}</h1>
  269. </a-col>
  270. </a-row>
  271. <a-row type="flex" justify="center">
  272. <a-col span="24">
  273. <a-form>
  274. <a-form-item>
  275. <a-input v-model.trim="user.username" placeholder='{{ i18n "username" }}'
  276. @keydown.enter.native="login" autofocus>
  277. <a-icon slot="prefix" type="user" style="font-size: 16px;"/>
  278. </a-input>
  279. </a-form-item>
  280. <a-form-item>
  281. <password-input icon="lock" v-model.trim="user.password"
  282. placeholder='{{ i18n "password" }}' @keydown.enter.native="login">
  283. </password-input>
  284. </a-form-item>
  285. <a-form-item v-if="secretEnable">
  286. <password-input icon="key" v-model.trim="user.loginSecret"
  287. placeholder='{{ i18n "secretToken" }}' @keydown.enter.native="login">
  288. </password-input>
  289. </a-input>
  290. </a-form-item>
  291. <a-form-item>
  292. <a-row justify="center" class="centered">
  293. <div class="wave-btn-bg wave-btn-bg-cl" :style="loading ? { width: '54px' } : { display: 'inline-block' }">
  294. <a-button class="ant-btn-primary-login" type="primary" :loading="loading" @click="login" :icon="loading ? 'poweroff' : undefined">
  295. [[ loading ? '' : '{{ i18n "login" }}' ]]
  296. </a-button>
  297. </div>
  298. </a-row>
  299. </a-form-item>
  300. <a-form-item>
  301. <a-row justify="center" class="centered">
  302. <a-col :span="24">
  303. <a-select ref="selectLang" v-model="lang" @change="setLang(lang)" style="width: 150px;" :dropdown-class-name="themeSwitcher.currentTheme">
  304. <a-select-option :value="l.value" label="English" v-for="l in supportLangs">
  305. <span role="img" aria-label="l.name" v-text="l.icon"></span>
  306. &nbsp;&nbsp;<span v-text="l.name"></span>
  307. </a-select-option>
  308. </a-select>
  309. </a-col>
  310. </a-row>
  311. </a-form-item>
  312. <a-form-item>
  313. <a-row justify="center" class="centered">
  314. <a-col>
  315. <a-icon type="bulb" :theme="themeSwitcher.isDarkTheme ? 'filled' : 'outlined'"></a-icon>&nbsp;
  316. </a-col>
  317. <a-col>
  318. <theme-switch />
  319. </a-col>
  320. </a-row>
  321. </a-form-item>
  322. </a-form>
  323. </a-col>
  324. </a-row>
  325. </a-col>
  326. </a-row>
  327. </a-layout-content>
  328. </transition>
  329. </a-layout>
  330. {{template "js" .}}
  331. {{template "component/themeSwitcher" .}}
  332. {{template "component/password" .}}
  333. <script>
  334. class User {
  335. constructor() {
  336. this.username = "";
  337. this.password = "";
  338. }
  339. }
  340. const app = new Vue({
  341. delimiters: ['[[', ']]'],
  342. el: '#app',
  343. data: {
  344. themeSwitcher,
  345. loading: false,
  346. user: new User(),
  347. secretEnable: false,
  348. lang: ""
  349. },
  350. async created() {
  351. this.lang = getLang();
  352. this.secretEnable = await this.getSecretStatus();
  353. },
  354. methods: {
  355. async login() {
  356. this.loading = true;
  357. const msg = await HttpUtil.post('/login', this.user);
  358. this.loading = false;
  359. if (msg.success) {
  360. location.href = basePath + 'panel/';
  361. }
  362. },
  363. async getSecretStatus() {
  364. this.loading = true;
  365. const msg = await HttpUtil.post('/getSecretStatus');
  366. this.loading = false;
  367. if (msg.success) {
  368. this.secretEnable = msg.obj;
  369. return msg.obj;
  370. }
  371. },
  372. },
  373. });
  374. </script>
  375. </body>
  376. </html>