add a small delay when logging in to reduce confusion

This commit is contained in:
MCHost
2025-06-22 21:33:47 -04:00
parent 9cc45ea48e
commit 02219a9aa2

View File

@ -261,7 +261,7 @@ export function handleAutoLogin(req, res) {
<title>Secure Auto Login</title> <title>Secure Auto Login</title>
<meta name="robots" content="noindex"> <meta name="robots" content="noindex">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'nonce-${nonce}'"> <meta http-equiv="Content-Security-Policy" content="default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'nonce-${nonce}'">
<meta http-equiv="refresh" content="5;url=/"> <meta http-equiv="refresh" content="2;url=/">
<style> <style>
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #111827; font-family: 'Arial', sans-serif; } body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #111827; font-family: 'Arial', sans-serif; }
.notification { background-color: #1f2937; color: white; padding: 16px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; gap: 12px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); max-width: 400px; width: 100%; } .notification { background-color: #1f2937; color: white; padding: 16px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; gap: 12px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); max-width: 400px; width: 100%; }
@ -285,12 +285,16 @@ export function handleAutoLogin(req, res) {
console.log('API key stored in localStorage'); console.log('API key stored in localStorage');
sessionStorage.setItem('sessionTimestamp', Date.now()); sessionStorage.setItem('sessionTimestamp', Date.now());
console.log('Session timestamp stored'); console.log('Session timestamp stored');
setTimeout(() => {
window.location.href = '/'; window.location.href = '/';
console.log('Redirect initiated to /'); console.log('Redirect initiated to /');
}, 2000);
} catch (e) { } catch (e) {
console.error('Storage error:', e.message); console.error('Storage error:', e.message);
setTimeout(() => {
window.location.href = '${encodeURI(process.env.AUTO_LOGIN_REDIRECT_URL)}'; window.location.href = '${encodeURI(process.env.AUTO_LOGIN_REDIRECT_URL)}';
console.log('Fallback redirect initiated to AUTO_LOGIN_REDIRECT_URL'); console.log('Fallback redirect initiated to AUTO_LOGIN_REDIRECT_URL');
}, 2000);
} }
})(); })();
</script> </script>