login.blade.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <style>
  2. .login-box {
  3. margin-top: -10rem;
  4. padding: 5px;
  5. }
  6. .login-card-body {
  7. padding: 1.5rem 1.8rem 1.6rem;
  8. }
  9. .card, .card-body {
  10. border-radius: .25rem
  11. }
  12. .login-btn {
  13. padding-left: 2rem!important;;
  14. padding-right: 1.5rem!important;
  15. }
  16. .content {
  17. overflow-x: hidden;
  18. }
  19. .form-group .control-label {
  20. text-align: left;
  21. }
  22. .justify-content-between {
  23. margin-top: 1rem;
  24. }
  25. #captcha {
  26. width: 185px;
  27. float: left;
  28. }
  29. .captcha-img {
  30. float: right;
  31. width: 110px;
  32. height: 34px;
  33. }
  34. </style>
  35. <div class="login-page bg-40">
  36. <div class="login-box">
  37. <div class="login-logo mb-2">
  38. {{ trans('admin.site_name') }}
  39. </div>
  40. <div class="card">
  41. <div class="card-body login-card-body shadow-100">
  42. {{-- <p class="login-box-msg mt-1 mb-1">{{ __('admin.welcome_back') }}</p>--}}
  43. <form id="login-form" method="POST" action="{{ admin_url('auth/login') }}">
  44. <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
  45. <fieldset class="form-label-group form-group position-relative has-icon-left">
  46. <input
  47. type="text"
  48. class="form-control {{ $errors->has('username') ? 'is-invalid' : '' }}"
  49. name="username"
  50. placeholder="{{ trans('admin.username') }}"
  51. value="{{ old('username') }}"
  52. required
  53. autofocus
  54. >
  55. <div class="form-control-position">
  56. <i class="feather icon-user"></i>
  57. </div>
  58. <label for="email">{{ trans('admin.username') }}</label>
  59. <div class="help-block with-errors"></div>
  60. @if($errors->has('username'))
  61. <span class="invalid-feedback text-danger" role="alert">
  62. @foreach($errors->get('username') as $message)
  63. <span class="control-label" for="inputError"><i class="feather icon-x-circle"></i> {{$message}}</span><br>
  64. @endforeach
  65. </span>
  66. @endif
  67. </fieldset>
  68. <fieldset class="form-label-group form-group position-relative has-icon-left">
  69. <input
  70. minlength="5"
  71. maxlength="20"
  72. id="password"
  73. type="password"
  74. class="form-control {{ $errors->has('password') ? 'is-invalid' : '' }}"
  75. name="password"
  76. placeholder="{{ trans('admin.password') }}"
  77. required
  78. autocomplete="current-password"
  79. >
  80. <div class="form-control-position">
  81. <i class="feather icon-lock"></i>
  82. </div>
  83. <label for="password">{{ trans('admin.password') }}</label>
  84. <div class="help-block with-errors"></div>
  85. @if($errors->has('password'))
  86. <span class="invalid-feedback text-danger" role="alert">
  87. @foreach($errors->get('password') as $message)
  88. <span class="control-label" for="inputError"><i class="feather icon-x-circle"></i> {{$message}}</span><br>
  89. @endforeach
  90. </span>
  91. @endif
  92. </fieldset>
  93. <fieldset class="form-label-group form-group position-relative has-icon-left">
  94. <input
  95. minlength="6"
  96. maxlength="6"
  97. id="captcha"
  98. type="captcha"
  99. class="form-control"
  100. name="captcha"
  101. placeholder="{{ trans('admin.captcha') }}"
  102. required
  103. >
  104. <img src="/prime-control/captcha?{{ time() }}" alt="captcha" class="captcha-img" onclick="this.src='/prime-control/captcha?'+Math.random()">
  105. <div class="form-control-position">
  106. <i class="feather icon-image"></i>
  107. </div>
  108. <label for="captcha">{{ trans('admin.captcha') }}</label>
  109. <div class="help-block with-errors"></div>
  110. @if($errors->has('captcha'))
  111. <span class="invalid-feedback text-danger" role="alert">
  112. @foreach($errors->get('captcha') as $message)
  113. <span class="control-label" for="inputError"><i class="feather icon-x-circle"></i> {{$message}}</span><br>
  114. @endforeach
  115. </span>
  116. @endif
  117. </fieldset>
  118. {{-- <div class="form-group d-flex justify-content-between align-items-center">--}}
  119. {{-- <div class="text-left">--}}
  120. {{-- <a class="lang-item" href="javascript:void(0);" data-lang="en">English</a>--}}
  121. {{-- / <a class="lang-item" href="javascript:void(0);" data-lang="zh_CN">中文</a>--}}
  122. {{-- </div>--}}
  123. {{-- </div>--}}
  124. <button type="submit" class="btn btn-primary float-letf login-btn">
  125. {{ __('admin.login') }}
  126. <i class="feather icon-arrow-right"></i>
  127. </button>
  128. <div class="form-group d-flex justify-content-between align-items-center">
  129. <div class="text-left">
  130. @if(config('admin.auth.remember'))
  131. <fieldset class="checkbox">
  132. <div class="vs-checkbox-con vs-checkbox-primary">
  133. <input id="remember" name="remember" value="1" type="checkbox" {{ old('remember') ? 'checked' : '' }}>
  134. <span class="vs-checkbox">
  135. <span class="vs-checkbox--check">
  136. <i class="vs-icon feather icon-check"></i>
  137. </span>
  138. </span>
  139. <span> {{ trans('admin.remember_me') }}</span>
  140. </div>
  141. </fieldset>
  142. @endif
  143. </div>
  144. </div>
  145. </form>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. <script>
  151. Dcat.ready(function () {
  152. // ajax表单提交
  153. $('#login-form').form({
  154. validate: true,
  155. });
  156. });
  157. </script>
  158. <script>
  159. document.querySelectorAll('.lang-item').forEach(item => {
  160. item.addEventListener('click', function() {
  161. const lang = this.getAttribute('data-lang');
  162. switchLanguage(lang);
  163. });
  164. });
  165. function switchLanguage(lang) {
  166. fetch(`/prime-control/language-switch?lang=${encodeURIComponent(lang)}`, {
  167. method: 'GET'
  168. })
  169. .then(response => {
  170. if (!response.ok) {
  171. throw new Error('Network response was not ok');
  172. }
  173. return response.json();
  174. })
  175. .then(data => {
  176. if (data.success) {
  177. window.location.reload();
  178. } else {
  179. throw new Error(data.error || 'Language switch failed');
  180. }
  181. })
  182. .catch(error => {
  183. console.error('Language Switch Error:', error);
  184. alert('Failed to switch language. Please try again.');
  185. });
  186. }
  187. </script>