diff --git a/app-code/login/index.php b/app-code/login/index.php index 68408be..9759b19 100644 --- a/app-code/login/index.php +++ b/app-code/login/index.php @@ -70,6 +70,9 @@ document.getElementById('statusText').textContent = 'Login warning'; var warningModal = new bootstrap.Modal(document.getElementById('externalWarningModal')); warningModal.show(); + document.getElementById('externalWarningModal').addEventListener('shown.bs.modal', function () { + document.getElementById('confirmExternalRedirect').focus(); + }); } else { // Redirect the user to the URL window.location.href = redirectUrl; @@ -82,10 +85,20 @@ } document.getElementById('confirmExternalRedirect').addEventListener('click', function() { + confirmExternalRedirect(); + }); + + document.addEventListener('keydown', function(e) { + if (e.key === 'Enter' && document.getElementById('externalWarningModal').classList.contains('show')) { + confirmExternalRedirect(); + } + }); + + function confirmExternalRedirect() { fetch('/api/login/confirm_external_redirect.php', { method: 'POST' }).then(() => { window.location.href = pendingRedirectUrl; }); - }); + } // Call the function on page load redirect();