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

66 lines
1.5 KiB
PHP

<?php
$token = $_GET["token"];
$token_hash = hash("sha256", $token);
$mysqli = require __DIR__ . "/database.php";
$sql = "SELECT * FROM user
WHERE reset_token_hash = ?";
$stmt = $mysqli->prepare($sql);
$stmt->bind_param("s", $token_hash);
$stmt->execute();
$result = $stmt->get_result();
$user = $result->fetch_assoc();
if ($user === null) {
die("token not found");
}
if (strtotime($user["reset_token_expires_at"]) <= time()) {
die("token has expired");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>eixogen</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="icon" href="img/favicon.ico" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="../style.css" rel="stylesheet">
<meta property="og:title" content="EIXOGEN" />
<meta property="og:description" content="EIXOGEN" />
<meta property="og:image" content="" />
</head>
<body>
<div class="init">
<h1>Reset Password</h1>
<form method="post" action="process-reset-password.php">
<input type="hidden" name="token" value="<?= htmlspecialchars($token) ?>">
<label for="password">New password</label>
<input type="password" id="password" name="password">
<label for="password_confirmation">Repeat password</label>
<input type="password" id="password_confirmation"
name="password_confirmation">
<button>Send</button>
</form>
</div>
</body>
</html>