PHPAuthentication & cryptographyDifficulty 2/3
<?php
// reset.php — step 2 of the password reset flow
session_start();
$expected = $_SESSION['reset_token']; // random token generated at step 1
$given = $_GET['token'];
if ($given == $expected) {
$_SESSION['reset_allowed'] = true;
header('Location: /reset/new-password');
exit;
}
http_response_code(403);
echo 'Invalid token';