You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.1 KiB

<?php
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
require_once __DIR__ . '/default.php';
require_once __DIR__ . '/auth.php';
$message = '';
$errors = [];
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$email = trim((string) ($_POST['email'] ?? ''));
if ($email === '') {
$errors[] = 'Please enter your email address.';
} elseif (requestPasswordReset($email)) {
$message = 'If the email exists in our records, a reset link has been sent.';
} else {
$message = 'If the email exists in our records, a reset link has been sent.';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Forgot Password - KaI</title>
<style>
body { font-family: Arial, sans-serif; background: #1e1e2e; color: #cdd6f4; display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; }
.card { background: #11111b; padding: 24px; border-radius: 10px; width: 360px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
input, button { width: 100%; padding: 10px; border-radius: 6px; border: 1px solid #45475a; background: #313244; color: #fff; margin-top: 10px; }
button { background: #89b4fa; color: #11111b; font-weight: bold; cursor: pointer; }
.message { color: #a6e3a1; margin-top: 12px; }
.error { color: #f38ba8; margin-top: 12px; }
a { color: #89b4fa; }
</style>
</head>
<body>
<div class="card">
<h1>Reset password</h1>
<p>Enter your email address and we will send you a reset link.</p>
<form method="post">
<input type="email" name="email" required placeholder="you@example.com">
<button type="submit">Send reset link</button>
</form>
<?php if (!empty($errors)): ?><div class="error"><?php echo htmlspecialchars(implode('<br>', $errors)); ?></div><?php endif; ?>
<?php if ($message !== ''): ?><div class="message"><?php echo htmlspecialchars($message); ?></div><?php endif; ?>
<p><a href="login.php">Back to login</a></p>
</div>
</body>
</html>