Added Email for Supabase
This commit is contained in:
@@ -25,6 +25,39 @@
|
||||
radial-gradient(circle at 20% 80%, #1a1a2e 0%, transparent 50%),
|
||||
radial-gradient(circle at 80% 20%, #16213e 0%, transparent 50%),
|
||||
radial-gradient(circle at 40% 40%, #0f3460 0%, transparent 50%);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.back-button {
|
||||
position: fixed;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
background: rgba(30, 41, 59, 0.95);
|
||||
backdrop-filter: blur(20px);
|
||||
border: 1px solid rgba(51, 65, 85, 0.3);
|
||||
border-radius: 12px;
|
||||
padding: 12px 20px;
|
||||
color: #00d4ff;
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
font-size: 0.9rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.back-button:hover {
|
||||
background: #00d4ff;
|
||||
color: #ffffff;
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 25px rgba(0, 212, 255, 0.3);
|
||||
}
|
||||
|
||||
.back-button::before {
|
||||
content: "← ";
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.container {
|
||||
@@ -183,6 +216,37 @@
|
||||
border-color: rgba(239, 68, 68, 0.3);
|
||||
}
|
||||
|
||||
.password-reset-container {
|
||||
display: none;
|
||||
margin-top: 1rem;
|
||||
padding: 1rem;
|
||||
background: rgba(239, 68, 68, 0.05);
|
||||
border: 1px solid rgba(239, 68, 68, 0.2);
|
||||
border-radius: 0.75rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.password-reset-container.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.password-reset-container p {
|
||||
color: #ef4444;
|
||||
margin-bottom: 1rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.btn-reset {
|
||||
background: linear-gradient(135deg, #ef4444, #dc2626);
|
||||
color: white;
|
||||
box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
|
||||
}
|
||||
|
||||
.btn-reset:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
|
||||
}
|
||||
|
||||
.loading {
|
||||
display: none;
|
||||
text-align: center;
|
||||
@@ -242,14 +306,24 @@
|
||||
.logo p {
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.back-button {
|
||||
top: 15px;
|
||||
right: 15px;
|
||||
padding: 10px 15px;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Back to Home Button -->
|
||||
<a href="/" class="back-button">Zur Hauptseite</a>
|
||||
|
||||
<div class="container">
|
||||
<div class="logo">
|
||||
<h1>🥷 NINJACROSS</h1>
|
||||
<p>Admin Authentication Portal</p>
|
||||
<p>Dein Dashboard</p>
|
||||
</div>
|
||||
|
||||
<div id="message"></div>
|
||||
@@ -272,6 +346,13 @@
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Sign In</button>
|
||||
</form>
|
||||
|
||||
<!-- Password Reset Container -->
|
||||
<div id="passwordResetContainer" class="password-reset-container">
|
||||
<p>Passwort vergessen? Kein Problem!</p>
|
||||
<button type="button" id="resetPasswordBtn" class="btn btn-reset">Passwort zurücksetzen</button>
|
||||
</div>
|
||||
|
||||
<div class="toggle-form">
|
||||
<p>Don't have an account? <button type="button" onclick="toggleForm()">Sign Up</button></p>
|
||||
</div>
|
||||
@@ -330,6 +411,7 @@
|
||||
loginForm.classList.add('active');
|
||||
}
|
||||
clearMessage();
|
||||
showPasswordReset(false); // Hide password reset when switching forms
|
||||
}
|
||||
|
||||
// Show message
|
||||
@@ -346,6 +428,16 @@
|
||||
document.getElementById('message').innerHTML = '';
|
||||
}
|
||||
|
||||
// Show/hide password reset container
|
||||
function showPasswordReset(show) {
|
||||
const resetContainer = document.getElementById('passwordResetContainer');
|
||||
if (show) {
|
||||
resetContainer.classList.add('active');
|
||||
} else {
|
||||
resetContainer.classList.remove('active');
|
||||
}
|
||||
}
|
||||
|
||||
// Show/hide loading
|
||||
function setLoading(show) {
|
||||
const loading = document.getElementById('loading');
|
||||
@@ -361,6 +453,7 @@
|
||||
e.preventDefault();
|
||||
setLoading(true);
|
||||
clearMessage();
|
||||
showPasswordReset(false); // Hide reset button initially
|
||||
|
||||
const email = document.getElementById('loginEmail').value;
|
||||
const password = document.getElementById('loginPassword').value;
|
||||
@@ -373,6 +466,8 @@
|
||||
|
||||
if (error) {
|
||||
showMessage(error.message, 'error');
|
||||
// Show password reset button on login failure
|
||||
showPasswordReset(true);
|
||||
} else {
|
||||
showMessage('Login successful! Redirecting...', 'success');
|
||||
setTimeout(() => {
|
||||
@@ -381,6 +476,7 @@
|
||||
}
|
||||
} catch (error) {
|
||||
showMessage('An unexpected error occurred', 'error');
|
||||
showPasswordReset(true);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -433,6 +529,36 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Handle password reset
|
||||
document.getElementById('resetPasswordBtn').addEventListener('click', async () => {
|
||||
const email = document.getElementById('loginEmail').value;
|
||||
|
||||
if (!email) {
|
||||
showMessage('Bitte geben Sie zuerst Ihre E-Mail-Adresse ein', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
setLoading(true);
|
||||
clearMessage();
|
||||
|
||||
try {
|
||||
const { error } = await supabase.auth.resetPasswordForEmail(email, {
|
||||
redirectTo: `${window.location.origin}/reset-password.html`
|
||||
});
|
||||
|
||||
if (error) {
|
||||
showMessage('Fehler beim Senden der E-Mail: ' + error.message, 'error');
|
||||
} else {
|
||||
showMessage('Passwort-Reset-E-Mail wurde gesendet! Bitte überprüfen Sie Ihr E-Mail-Postfach.', 'success');
|
||||
showPasswordReset(false);
|
||||
}
|
||||
} catch (error) {
|
||||
showMessage('Ein unerwarteter Fehler ist aufgetreten', 'error');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
});
|
||||
|
||||
// Check authentication on page load
|
||||
checkAuth();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user