From 546dd7e2df2ba49b0aac7de2dbc8cc6d04da3ee9 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Thu, 5 Jun 2025 16:50:38 +0200 Subject: [PATCH] Update templates and controllers for 2fa --- resources/views/themes/Gentele/2fa_enable.tpl | 108 +++++++++++++++++- .../views/themes/Gentele/profileedit.tpl | 51 +++++++++ 2 files changed, 155 insertions(+), 4 deletions(-) diff --git a/resources/views/themes/Gentele/2fa_enable.tpl b/resources/views/themes/Gentele/2fa_enable.tpl index 164085ae5..f5b70cced 100644 --- a/resources/views/themes/Gentele/2fa_enable.tpl +++ b/resources/views/themes/Gentele/2fa_enable.tpl @@ -89,14 +89,19 @@ {{csrf_field()}}
-
- - +
+ + + + + +
+
Enter the 6-digit code from your authenticator app
- @@ -136,16 +141,111 @@ .notification-fade.show { opacity: 1; } + +.otp-input { + width: 45px; + height: 45px; + font-size: 1.2rem; + font-weight: bold; +} + +@media (max-width: 576px) { + .otp-input { + width: 40px; + height: 40px; + font-size: 1.1rem; + } +} diff --git a/resources/views/themes/Gentele/profileedit.tpl b/resources/views/themes/Gentele/profileedit.tpl index e4a7a0a41..8b172673a 100755 --- a/resources/views/themes/Gentele/profileedit.tpl +++ b/resources/views/themes/Gentele/profileedit.tpl @@ -488,6 +488,57 @@ this.setAttribute('data-bs-original-title', 'Copy to clipboard'); }, 2000); }); + + // Check if there's a hash in the URL to activate the appropriate tab + var hash = window.location.hash; + if (hash) { + var tabId = hash.substring(1); + var tabElement = document.getElementById(tabId + '-tab'); + if (tabElement) { + var tab = new bootstrap.Tab(tabElement); + tab.show(); + + // If the security tab is opened and there are 2FA messages, animate them + if (tabId === 'security') { + animateAlerts(); + } + } + } + + // Animate alerts when they become visible + function animateAlerts() { + var alerts = document.querySelectorAll('#security .alert'); + alerts.forEach(function(alert) { + if (alert.style.opacity !== '1') { + alert.style.opacity = '0'; + alert.style.transition = 'opacity 0.4s ease-in-out'; + setTimeout(function() { + alert.style.opacity = '1'; + }, 100); + + // Add auto-dismiss after 10 seconds for success alerts + if (alert.classList.contains('alert-success')) { + setTimeout(function() { + alert.style.opacity = '0'; + setTimeout(function() { + alert.style.display = 'none'; + }, 400); + }, 10000); + } + } + }); + } + + // Add event listener for tab changes + var tabElements = document.querySelectorAll('a[data-bs-toggle="tab"]'); + tabElements.forEach(function(tabElement) { + tabElement.addEventListener('shown.bs.tab', function(event) { + // When security tab is shown, animate alerts + if (event.target.getAttribute('href') === '#security') { + animateAlerts(); + } + }); + }); }); {/literal}