login.html 9.5 KB

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