forgot
This commit is contained in:
parent
9bc03d5115
commit
466e6355cc
@ -19,10 +19,11 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
|
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$token = bin2hex(random_bytes(50));
|
$token = bin2hex(random_bytes(50));
|
||||||
$expires = date("U") + 1800; // 30 minutes
|
$expires_timestamp = time() + 1800; // 30 minutes
|
||||||
|
$expires_datetime = date('Y-m-d H:i:s', $expires_timestamp);
|
||||||
|
|
||||||
$stmt = $pdo->prepare("INSERT INTO password_resets (email, token, expires) VALUES (?, ?, ?)");
|
$stmt = $pdo->prepare("INSERT INTO password_resets (email, token, expires_at) VALUES (?, ?, ?)");
|
||||||
$stmt->execute([$email, $token, $expires]);
|
$stmt->execute([$email, $token, $expires_datetime]);
|
||||||
|
|
||||||
$reset_link = "http://" . $_SERVER['HTTP_HOST'] . "/reset_password_form.php?token=" . $token;
|
$reset_link = "http://" . $_SERVER['HTTP_HOST'] . "/reset_password_form.php?token=" . $token;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user