block user in django admin

This commit is contained in:
javad committed 2026-10-14 12:27:55 +03:30
1 parent 089db0afa4
commit fe7a10cb61
19 files changed
+574 -11

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
(() => {
const script = document.querySelector('script[data-customer-login-access]');
if (!script) return;
let pending = false;
async function checkAccess() {
if (pending || document.hidden) return;
pending = true;
try {
const response = await fetch(script.dataset.customerLoginAccess, {
credentials: 'same-origin', cache: 'no-store', headers: {Accept: 'application/json'}
});
if (!response.ok) return;
const result = await response.json();
if (!result.authenticated) window.location.replace(result.login_url);
} catch (_) {
// Retry on the next heartbeat or when the browser returns online.
} finally {
pending = false;
}
}
window.setInterval(checkAccess, 10000);
document.addEventListener('visibilitychange', checkAccess);
window.addEventListener('pageshow', checkAccess);
window.addEventListener('online', checkAccess);
})();