( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
session_start();
require_once __DIR__ . '/lib/Db.php';
// If authenticated, you can still reset; keep page accessible
$error = null; $info = null; $resetLink = null;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$email = trim($_POST['email'] ?? '');
if ($email === '' || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error = 'Please enter a valid email address';
} else {
$token = create_password_reset_token($email, 60);
if ($token) {
$info = 'We have generated a reset link. For testing, use the link below.';
$resetLink = 'reset.php?token=' . urlencode($token);
} else {
$error = 'No account found for that email, or reset could not be initiated';
}
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Strategy & Content Studio — Forgot Password</title>
<link rel="stylesheet" href="assets/styles.css">
</head>
<body>
<header>
<h1>Strategy & Content Studio</h1>
</header>
<div class="layout">
<aside>
<h2 style="color:#f9fafb; font-size:18px; margin-top:0;">Password Reset</h2>
<div style="margin-top:12px; font-size:12px; color:#9ca3af;">We’ll create a one-time reset link.</div>
</aside>
<div class="container">
<div class="card" style="max-width: 520px;">
<div class="hero hero-aws">
<div class="title">Forgot your password?</div>
<div class="subtitle">Enter your email and we’ll generate a secure reset link.</div>
<div class="cta-group">
<a class="button secondary" href="auth.php">Back to Sign in</a>
<a class="button secondary" href="register.php">Create account</a>
</div>
</div>
<?php if ($error): ?>
<div class="notice error"><?php echo htmlspecialchars($error, ENT_QUOTES, 'UTF-8'); ?></div>
<?php endif; ?>
<?php if ($info): ?>
<div class="notice"><?php echo htmlspecialchars($info, ENT_QUOTES, 'UTF-8'); ?></div>
<?php endif; ?>
<?php if ($resetLink): ?>
<div class="config">Reset Link (testing): <a href="<?php echo htmlspecialchars($resetLink, ENT_QUOTES, 'UTF-8'); ?>"><?php echo htmlspecialchars($resetLink, ENT_QUOTES, 'UTF-8'); ?></a></div>
<?php endif; ?>
<form method="post">
<div class="row"><input type="text" name="email" placeholder="Email" required></div>
<div class="row"><button type="submit">Send Reset Link</button></div>
</form>
</div>
</div>
</div>
</body>
</html>