Files
xxx-sphere-web/bin/main/static/forgot-password.html

114 lines
3.7 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/img/icon.png" type="image/png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Passwort vergessen xXx Sphere</title>
<link rel="stylesheet" href="/css/variables.css">
<link rel="stylesheet" href="/css/style.css">
<style>
.overlay {
display: none;
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.7);
z-index: 100;
align-items: center;
justify-content: center;
}
.overlay.active {
display: flex;
}
.modal {
background: var(--color-card);
border: 1px solid var(--color-secondary);
border-radius: 12px;
padding: 2rem;
max-width: 340px;
width: 90%;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
text-align: center;
}
.modal p {
color: var(--color-text);
font-size: 0.95rem;
margin-bottom: 1.5rem;
line-height: 1.5;
}
</style>
</head>
<body>
<div class="card">
<img src="icon.png" alt="Logo">
<h1>Passwort vergessen</h1>
<p class="subtitle">Gib deine E-Mail-Adresse ein. Falls sie bei uns registriert ist, erhältst du einen Link zum Zurücksetzen.</p>
<label for="email">E-Mail</label>
<input type="email" id="email" placeholder="deine@email.de" autocomplete="email" />
<button class="full-width" id="submitBtn" onclick="submit()">Link anfordern</button>
<div class="message" id="message"></div>
<p style="text-align:center; margin-top:1.25rem; font-size:0.85rem;">
<a href="/login.html" style="color:var(--color-primary);">Zurück zum Login</a>
</p>
</div>
<div class="overlay" id="overlay">
<div class="modal">
<p>Falls diese E-Mail-Adresse bei uns registriert ist, erhältst du in Kürze einen Link zum Zurücksetzen deines Passworts.</p>
<button class="full-width" onclick="goToLogin()">Zum Login</button>
</div>
</div>
<script>
document.addEventListener('keydown', e => {
if (e.key === 'Enter') submit();
});
async function submit() {
const email = document.getElementById('email').value.trim();
const btn = document.getElementById('submitBtn');
if (!email) {
showMessage('Bitte E-Mail-Adresse eingeben.', 'error');
return;
}
btn.disabled = true;
btn.textContent = 'Wird gesendet…';
hideMessage();
try {
await fetch('/password-reset/request', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email })
});
} catch (err) {
console.error(err);
}
document.getElementById('overlay').classList.add('active');
}
function goToLogin() {
window.location.href = '/login.html';
}
function showMessage(text, type) {
const el = document.getElementById('message');
el.textContent = text;
el.className = `message ${type}`;
el.style.display = 'block';
}
function hideMessage() {
document.getElementById('message').style.display = 'none';
}
</script>
</body>
</html>