adding redirect warnings to external systems
Deploy / deploy (push) Successful in 33s

This commit is contained in:
2026-05-07 22:37:44 +02:00
parent f9a814445b
commit f038581c34
5 changed files with 86 additions and 10 deletions
+45 -6
View File
@@ -12,15 +12,39 @@
<body>
<div class="d-flex flex-column justify-content-center align-items-center" style="height: 100vh;">
<!-- Spinner -->
<div class="spinner-border text-primary mb-3" role="status">
<div class="spinner-border text-primary mb-3" role="status" id="loadingSpinner">
<span class="visually-hidden">Loading...</span>
</div>
<!-- Redirecting Text -->
<p class="text-center fs-4">Redirecting...</p>
<p class="text-center fs-4" id="statusText">Redirecting...</p>
</div>
<div class="modal fade" id="externalWarningModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="externalWarningModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="externalWarningModalLabel">⚠️ External Login Warning</h5>
</div>
<div class="modal-body">
<p>You are being logged in into <strong id="externalDomainDisplay"></strong></p>
<p>This service is <strong>not operated by Jakach</strong>. The service will have access to:</p>
<ul>
<li>Email username</li>
<li>Telegram ID</li>
<li>User ID &amp; User Token</li>
</ul>
<p class="mb-0 text-muted">Do you want to continue?</p>
</div>
<div class="modal-footer">
<a href="/account/" class="btn btn-secondary">Cancel</a>
<button type="button" class="btn btn-primary" id="confirmExternalRedirect">Continue</button>
</div>
</div>
</div>
</div>
<script>
const redirect_api="/api/login/redirect.php";
let pendingRedirectUrl = null;
async function redirect() {
try {
@@ -39,15 +63,30 @@
// Check if the redirect URL exists
if (redirectUrl) {
// Redirect the user to the URL
window.location.href = redirectUrl;
if (data.message === 'external_redirect_warning') {
pendingRedirectUrl = redirectUrl;
document.getElementById('externalDomainDisplay').textContent = data.domain;
document.getElementById('loadingSpinner').style.display = 'none';
document.getElementById('statusText').textContent = 'Login warning';
var warningModal = new bootstrap.Modal(document.getElementById('externalWarningModal'));
warningModal.show();
} else {
// Redirect the user to the URL
window.location.href = redirectUrl;
}
}
} catch (error) {
// Handle errors (e.g., network issues or API errors)
console.error("Error fetching data:", error);
}
}
}
document.getElementById('confirmExternalRedirect').addEventListener('click', function() {
fetch('/api/login/confirm_external_redirect.php', { method: 'POST' }).then(() => {
window.location.href = pendingRedirectUrl;
});
});
// Call the function on page load
redirect();
</script>