<?php
include '../config.php';

$token = $_POST['token'];
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);

$query = mysqli_query($conn, "UPDATE pengguna SET password='$password', reset_token=NULL WHERE reset_token='$token'");

if ($query) {
    header("Location: ../login.php?pesan=Password berhasil direset.");
} else {
    echo "Gagal reset password.";
}
