login.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <!DOCTYPE html>
  2. <html lang="{{ get_locale() }}">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta name="csrf-token" content="{{ csrf_token() }}">
  7. <title>{{ _("Login - SquidStats Admin") }}</title>
  8. <link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon"/>
  9. <script src="{{ url_for('static', filename='src/tailwind.min.js') }}"></script>
  10. <link rel="stylesheet" href="{{ url_for('static', filename='all.min.css') }}">
  11. <style>
  12. .login-bg {
  13. background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #1e40af 100%);
  14. }
  15. .glass-card {
  16. background: rgba(255, 255, 255, 0.95);
  17. backdrop-filter: blur(10px);
  18. }
  19. .input-focus:focus {
  20. box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
  21. }
  22. .btn-gradient {
  23. background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  24. }
  25. .btn-gradient:hover {
  26. background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  27. }
  28. .float-animation {
  29. animation: float 6s ease-in-out infinite;
  30. }
  31. @keyframes float {
  32. 0%, 100% { transform: translateY(0px); }
  33. 50% { transform: translateY(-20px); }
  34. }
  35. .pulse-slow {
  36. animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  37. }
  38. /* Hide native password reveal button in Edge */
  39. input[type="password"]::-ms-reveal {
  40. display: none;
  41. }
  42. </style>
  43. </head>
  44. <body class="login-bg min-h-screen flex items-center justify-center p-4">
  45. <!-- Background decoration -->
  46. <div class="fixed inset-0 overflow-hidden pointer-events-none">
  47. <div class="absolute -top-40 -right-40 w-80 h-80 bg-blue-400 rounded-full mix-blend-multiply filter blur-xl opacity-30 float-animation"></div>
  48. <div class="absolute -bottom-40 -left-40 w-80 h-80 bg-purple-400 rounded-full mix-blend-multiply filter blur-xl opacity-30 float-animation" style="animation-delay: 2s;"></div>
  49. <div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-96 h-96 bg-cyan-400 rounded-full mix-blend-multiply filter blur-xl opacity-20 float-animation" style="animation-delay: 4s;"></div>
  50. </div>
  51. <!-- Login Card -->
  52. <div class="glass-card rounded-2xl shadow-2xl w-full max-w-md p-8 relative z-10">
  53. <!-- Logo/Header -->
  54. <div class="text-center mb-8">
  55. <div class="inline-flex items-center justify-center w-24 h-24 mb-4">
  56. <img
  57. src="{{ url_for('static', filename='squidstats.webp') }}"
  58. alt="{{ _("SquidStats") }}"
  59. class="w-full h-full object-contain drop-shadow-lg"
  60. >
  61. </div>
  62. <h1 class="text-2xl font-bold text-gray-800">{{ _("SquidStats") }}</h1>
  63. <p class="text-gray-500 mt-1">{{ _("Panel de Administración") }}</p>
  64. </div>
  65. <!-- Error Message -->
  66. {% if error %}
  67. <div class="bg-red-50 border-l-4 border-red-500 p-4 mb-6 rounded-r-lg">
  68. <div class="flex items-center">
  69. <i class="fas fa-exclamation-circle text-red-500 mr-3"></i>
  70. <p class="text-red-700 text-sm">{{ error }}</p>
  71. </div>
  72. </div>
  73. {% endif %}
  74. <!-- Flash Messages -->
  75. {% with messages = get_flashed_messages(with_categories=true) %}
  76. {% if messages %}
  77. {% for category, message in messages %}
  78. <div class="{% if category == 'success' %}bg-green-50 border-l-4 border-green-500{% elif category == 'warning' %}bg-yellow-50 border-l-4 border-yellow-500{% else %}bg-red-50 border-l-4 border-red-500{% endif %} p-4 mb-6 rounded-r-lg">
  79. <div class="flex items-center">
  80. <i class="fas fa-{% if category == 'success' %}check-circle text-green-500{% elif category == 'warning' %}exclamation-triangle text-yellow-500{% else %}exclamation-circle text-red-500{% endif %} mr-3"></i>
  81. <p class="{% if category == 'success' %}text-green-700{% elif category == 'warning' %}text-yellow-700{% else %}text-red-700{% endif %} text-sm">{{ message }}</p>
  82. </div>
  83. </div>
  84. {% endfor %}
  85. {% endif %}
  86. {% endwith %}
  87. <!-- Login Form -->
  88. <form method="POST" action="{{ url_for('auth.login') }}" class="space-y-6">
  89. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
  90. <!-- Username Field -->
  91. <div>
  92. <label for="username" class="block text-sm font-medium text-gray-700 mb-2">
  93. <i class="fas fa-user mr-2 text-gray-400"></i>{{ _("Usuario") }}
  94. </label>
  95. <div class="relative">
  96. <input
  97. type="text"
  98. id="username"
  99. name="username"
  100. required
  101. autocomplete="username"
  102. class="input-focus w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200"
  103. placeholder="{{ _("Ingresa tu usuario") }}"
  104. >
  105. </div>
  106. </div>
  107. <!-- Password Field -->
  108. <div>
  109. <label for="password" class="block text-sm font-medium text-gray-700 mb-2">
  110. <i class="fas fa-lock mr-2 text-gray-400"></i>{{ _("Contraseña") }}
  111. </label>
  112. <div class="relative">
  113. <input
  114. type="password"
  115. id="password"
  116. name="password"
  117. required
  118. autocomplete="current-password"
  119. class="input-focus w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200 pr-11"
  120. placeholder="{{ _("Ingresa tu contraseña") }}"
  121. >
  122. <button
  123. type="button"
  124. onclick="togglePassword()"
  125. class="absolute right-4 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600 focus:outline-none"
  126. >
  127. <i class="fas fa-eye" id="toggleIcon"></i>
  128. </button>
  129. </div>
  130. </div>
  131. <!-- Remember Me -->
  132. <div class="flex items-center justify-between">
  133. <label class="flex items-center">
  134. <input
  135. type="checkbox"
  136. name="remember"
  137. class="w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"
  138. >
  139. <span class="ml-2 text-sm text-gray-600">{{ _("Recordarme") }}</span>
  140. </label>
  141. </div>
  142. <!-- Submit Button -->
  143. <button
  144. type="submit"
  145. class="btn-gradient w-full py-3 px-4 text-white font-semibold rounded-lg shadow-lg hover:shadow-xl transform hover:-translate-y-0.5 transition-all duration-200 flex items-center justify-center"
  146. >
  147. <i class="fas fa-sign-in-alt mr-2"></i>
  148. {{ _("Iniciar Sesión") }}
  149. </button>
  150. </form>
  151. <!-- Footer -->
  152. <div class="mt-8 pt-6 border-t border-gray-200 text-center">
  153. <p class="text-gray-500 text-sm">
  154. <i class="fas fa-shield-alt mr-1"></i>
  155. {{ _("Conexión segura con JWT") }}
  156. </p>
  157. <a href="{{ url_for('main.index') }}" class="inline-flex items-center mt-3 text-blue-600 hover:text-blue-800 text-sm font-medium transition-colors">
  158. <i class="fas fa-arrow-left mr-2"></i>
  159. {{ _("Volver al Dashboard Principal") }}
  160. </a>
  161. </div>
  162. </div>
  163. <!-- Version Badge -->
  164. <div class="fixed bottom-4 right-4 text-white/50 text-xs">
  165. {{ _("SquidStats v") }}{{ config.VERSION }}
  166. </div>
  167. <script>
  168. function togglePassword() {
  169. const passwordInput = document.getElementById('password');
  170. const toggleIcon = document.getElementById('toggleIcon');
  171. if (passwordInput.type === 'password') {
  172. passwordInput.type = 'text';
  173. toggleIcon.classList.remove('fa-eye');
  174. toggleIcon.classList.add('fa-eye-slash');
  175. } else {
  176. passwordInput.type = 'password';
  177. toggleIcon.classList.remove('fa-eye-slash');
  178. toggleIcon.classList.add('fa-eye');
  179. }
  180. }
  181. // Auto-focus on username field
  182. document.addEventListener('DOMContentLoaded', function() {
  183. document.getElementById('username').focus();
  184. });
  185. // Form submission loading state
  186. document.querySelector('form').addEventListener('submit', function(e) {
  187. const btn = this.querySelector('button[type="submit"]');
  188. btn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i>Verificando...';
  189. btn.disabled = true;
  190. });
  191. </script>
  192. </body>
  193. </html>