30 lines
772 B
JavaScript
30 lines
772 B
JavaScript
// Change Password stuff
|
|
|
|
document.querySelector("#changePass").addEventListener("submit", e =>
|
|
{
|
|
e.preventDefault();
|
|
let formData = new FormData();
|
|
if (document.querySelector("#pass").value !== document.querySelector("#rePass").value)
|
|
{
|
|
alert("Passwords do not match");
|
|
}
|
|
else
|
|
{
|
|
formData.append("password", document.querySelector("#rePass").value);
|
|
fetch("changePassword.php", {
|
|
method: "POST",
|
|
body: formData
|
|
}).then(res => res.json().then(json =>
|
|
{
|
|
if (json.message === "ok")
|
|
{
|
|
alert("Password changed successfully");
|
|
}
|
|
else
|
|
{
|
|
alert(json.message);
|
|
}
|
|
}));
|
|
}
|
|
|
|
}); |