Ver código fonte

feat: add login page for captive portal access

Manuel 2 meses atrás
pai
commit
d7e7c76aab
1 arquivos alterados com 80 adições e 0 exclusões
  1. 80 0
      templates/captive_portal/login.html

+ 80 - 0
templates/captive_portal/login.html

@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<html lang="{{ get_locale() }}">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="csrf-token" content="{{ csrf_token() }}">
+    <meta name="description" content="{{ _('Portal cautivo de acceso a la red.') }}">
+    <title>{{ settings.portal_title }}</title>
+    <link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon"/>
+    <script src="{{ url_for('static', filename='src/tailwind.min.js') }}"></script>
+    <link rel="stylesheet" href="{{ url_for('static', filename='all.min.css') }}">
+    <style>
+        .login-bg {
+            background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #1e40af 100%);
+        }
+        .glass-card {
+            background: rgba(255, 255, 255, 0.95);
+            backdrop-filter: blur(10px);
+        }
+    </style>
+</head>
+<body class="login-bg min-h-screen flex items-center justify-center p-4">
+    <div class="glass-card rounded-2xl shadow-2xl w-full max-w-md p-8 relative z-10">
+        <div class="text-center mb-8">
+            <div class="inline-flex items-center justify-center w-20 h-20 mb-4">
+                <img src="{{ url_for('static', filename='squidstats-128.webp') }}" alt="{{ _("SquidStats") }}" width="80" height="80" class="w-full h-full object-contain drop-shadow-lg">
+            </div>
+            <h1 class="text-2xl font-bold text-gray-800">{{ settings.portal_title }}</h1>
+            <p class="text-gray-500 mt-1">{{ _("Inicia sesión para acceder a Internet") }}</p>
+        </div>
+
+        {% if error %}
+        <div class="bg-red-50 border-l-4 border-red-500 p-4 mb-6 rounded-r-lg">
+            <div class="flex items-center">
+                <i class="fas fa-exclamation-circle text-red-500 mr-3"></i>
+                <p class="text-red-700 text-sm">{{ error }}</p>
+            </div>
+        </div>
+        {% endif %}
+
+        {% with messages = get_flashed_messages(with_categories=true) %}
+            {% if messages %}
+                {% for category, message in messages %}
+                <div class="{% if category == 'success' %}bg-green-50 border-l-4 border-green-500{% else %}bg-red-50 border-l-4 border-red-500{% endif %} p-4 mb-6 rounded-r-lg">
+                    <p class="{% if category == 'success' %}text-green-700{% else %}text-red-700{% endif %} text-sm">{{ message }}</p>
+                </div>
+                {% endfor %}
+            {% endif %}
+        {% endwith %}
+
+        <form method="POST" action="{{ url_for('captive_portal.login') }}" class="space-y-6">
+            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
+            <input type="hidden" name="redirect" value="{{ redirect_url }}"/>
+
+            <div>
+                <label for="username" class="block text-sm font-medium text-gray-700 mb-2">
+                    <i class="fas fa-user mr-2 text-gray-400"></i>{{ _("Usuario") }}
+                </label>
+                <input type="text" id="username" name="username" required autocomplete="username"
+                    class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
+                    placeholder="{{ _("Ingresa tu usuario") }}">
+            </div>
+
+            <div>
+                <label for="password" class="block text-sm font-medium text-gray-700 mb-2">
+                    <i class="fas fa-lock mr-2 text-gray-400"></i>{{ _("Contraseña") }}
+                </label>
+                <input type="password" id="password" name="password" required autocomplete="current-password"
+                    class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
+                    placeholder="{{ _("Ingresa tu contraseña") }}">
+            </div>
+
+            <button type="submit"
+                class="w-full py-3 px-4 text-white font-semibold rounded-lg shadow-lg bg-blue-600 hover:bg-blue-700 transition-colors duration-200 flex items-center justify-center">
+                <i class="fas fa-sign-in-alt mr-2"></i>{{ _("Conectarme a Internet") }}
+            </button>
+        </form>
+    </div>
+</body>
+</html>