|
|
@@ -18,6 +18,22 @@
|
|
|
<i class="fas fa-check-circle text-6xl text-green-500 mb-4"></i>
|
|
|
<h1 class="text-2xl font-bold text-gray-800 mb-2">{{ _("¡Ya tienes acceso a Internet!") }}</h1>
|
|
|
<p class="text-gray-500">{{ _("Puedes cerrar esta ventana y continuar navegando.") }}</p>
|
|
|
+ <div class="mt-6 rounded-lg bg-gray-50 p-4 text-left">
|
|
|
+ <div class="flex items-center justify-between text-sm text-gray-600">
|
|
|
+ <span>{{ _("Tiempo restante") }}</span>
|
|
|
+ <strong id="remaining-time" class="text-lg text-blue-700">--:--:--</strong>
|
|
|
+ </div>
|
|
|
+ <div class="mt-3 grid grid-cols-2 gap-3 text-xs text-gray-500">
|
|
|
+ <div>
|
|
|
+ <div>{{ _("Inicio") }}</div>
|
|
|
+ <div class="font-medium text-gray-700">{{ active_session.created_at | datetime_format }}</div>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <div>{{ _("Vencimiento") }}</div>
|
|
|
+ <div class="font-medium text-gray-700">{{ active_session.expires_at | datetime_format }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<form method="POST" action="{{ url_for('captive_portal.logout') }}" class="mt-6">
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
|
<button type="submit" class="px-4 py-2 text-sm font-medium text-red-700 border border-red-300 rounded-lg hover:bg-red-50">
|
|
|
@@ -25,5 +41,32 @@
|
|
|
</button>
|
|
|
</form>
|
|
|
</div>
|
|
|
+ <script>
|
|
|
+ (() => {
|
|
|
+ let remainingSeconds = {{ remaining_seconds|int }};
|
|
|
+ const remainingTime = document.getElementById("remaining-time");
|
|
|
+ const expiredText = {{ _("Sesión expirada")|tojson }};
|
|
|
+
|
|
|
+ const updateRemainingTime = () => {
|
|
|
+ if (remainingSeconds <= 0) {
|
|
|
+ remainingTime.textContent = expiredText;
|
|
|
+ remainingTime.classList.remove("text-blue-700");
|
|
|
+ remainingTime.classList.add("text-red-600");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const hours = Math.floor(remainingSeconds / 3600);
|
|
|
+ const minutes = Math.floor((remainingSeconds % 3600) / 60);
|
|
|
+ const seconds = remainingSeconds % 60;
|
|
|
+ remainingTime.textContent = [hours, minutes, seconds]
|
|
|
+ .map((value) => String(value).padStart(2, "0"))
|
|
|
+ .join(":");
|
|
|
+ remainingSeconds -= 1;
|
|
|
+ };
|
|
|
+
|
|
|
+ updateRemainingTime();
|
|
|
+ window.setInterval(updateRemainingTime, 1000);
|
|
|
+ })();
|
|
|
+ </script>
|
|
|
</body>
|
|
|
</html>
|