login.html 9.1 KB

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