LPA-Health V1.2
This commit is contained in:
parent
efd6077fc9
commit
8b1250d5af
@ -26,8 +26,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$update = db()->prepare('UPDATE users SET reset_token = ?, reset_expires_at = ? WHERE id = ?');
|
||||
$update->execute([$token, $expiry, $user['id']]);
|
||||
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
|
||||
$protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') ? 'https' : 'http';
|
||||
$reset_link = "$protocol://$host/reset-password.php?token=$token";
|
||||
|
||||
$subject = 'Reset Your Password';
|
||||
|
||||
@ -28,8 +28,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' || isset($_GET['email'])) {
|
||||
$stmt = $db->prepare('UPDATE users SET verification_token = ? WHERE id = ?');
|
||||
if ($stmt->execute([$token, $user['id']])) {
|
||||
// Send verification email
|
||||
$proto = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
$proto = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
|
||||
$verify_link = "$proto://$host/verify.php?token=$token";
|
||||
|
||||
$subject = "Verify your account - $project_name";
|
||||
@ -56,9 +56,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' || isset($_GET['email'])) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// We don't want to reveal if an email exists, but in this specific context (resend activation),
|
||||
// it's usually okay or we can say "If an account exists, a link was sent".
|
||||
// However, the original signup reveals it, so let's just say not found for simplicity here.
|
||||
$error = 'No account found with this email address.';
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,8 +37,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$stmt = $db->prepare('INSERT INTO users (name, email, password, is_verified, verification_token) VALUES (?, ?, ?, 0, ?)');
|
||||
if ($stmt->execute([$name, $email, $hashed_password, $token])) {
|
||||
// Send verification email
|
||||
$proto = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
$proto = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
|
||||
$verify_link = "$proto://$host/verify.php?token=$token";
|
||||
|
||||
$subject = "Verify your account - $project_name";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user