prepare("SELECT * FROM Users WHERE email=:email");
$q->execute([
":email" => $_GET["email"]
]);
$u = $q->fetch();
if(!$u["verified"] && $u){
email("Nuovo Account", 'Grazie per esserti registratÉ™ su MordApp
Verifica il mio account', $u["email"], $u["name"]);
?>
Mordapp
Email re-inviata
OK
prepare("UPDATE Users SET passwordHash=:ph, emailToken=:ett WHERE emailToken=:et ");
$q->execute([
":ph" => password_hash($_POST["password"],PASSWORD_DEFAULT),
":et" => $_POST["tk"],
":ett" => bin2hex(random_bytes(16))
]);
http_response_code(302);
header("Location: .");
}
elseif(!empty($_GET["recover"])){
?>
Mordapp
Recupero password
prepare("UPDATE Users SET emailToken=:et WHERE email=:email");
$q->execute([
":email" => $_GET["email"],
":et" => $tk
]);
email("Recupero Account", 'Devi recuperare la tua password?
Recupera il mio account', $u["email"], $u["name"]);
?>
Mordapp
Email inviata
OK