userpage: time-pad pwr request for ambiguity
the user shouldn't know if the reset has actually been sent (i.e. if an account with the given contact address exists), so the backend response is always sent after 1 second.
This commit is contained in:
+16
-12
@@ -63,18 +63,22 @@ window.notifications = new notificationBox(document.getElementById('notification
|
||||
if (window.pwrEnabled && window.linkResetEnabled) {
|
||||
const submitButton = document.getElementById("pwr-submit");
|
||||
const input = document.getElementById("pwr-address") as HTMLInputElement;
|
||||
submitButton.onclick = () => _post("/my/password/reset/" + input.value, null, (req: XMLHttpRequest) => {
|
||||
if (req.readyState != 4) return;
|
||||
if (req.status != 204) {
|
||||
window.notifications.customError("unkownError", window.lang.notif("errorUnknown"));;
|
||||
window.modals.pwr.close();
|
||||
return;
|
||||
}
|
||||
window.modals.pwr.modal.querySelector(".heading").textContent = window.lang.strings("resetSent");
|
||||
window.modals.pwr.modal.querySelector(".content").textContent = window.lang.strings("resetSentDescription");
|
||||
submitButton.classList.add("unfocused");
|
||||
input.classList.add("unfocused");
|
||||
});
|
||||
submitButton.onclick = () => {
|
||||
toggleLoader(submitButton);
|
||||
_post("/my/password/reset/" + input.value, null, (req: XMLHttpRequest) => {
|
||||
if (req.readyState != 4) return;
|
||||
toggleLoader(submitButton);
|
||||
if (req.status != 204) {
|
||||
window.notifications.customError("unkownError", window.lang.notif("errorUnknown"));;
|
||||
window.modals.pwr.close();
|
||||
return;
|
||||
}
|
||||
window.modals.pwr.modal.querySelector(".heading").textContent = window.lang.strings("resetSent");
|
||||
window.modals.pwr.modal.querySelector(".content").textContent = window.lang.strings("resetSentDescription");
|
||||
submitButton.classList.add("unfocused");
|
||||
input.classList.add("unfocused");
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
const grid = document.querySelector(".grid");
|
||||
|
||||
Reference in New Issue
Block a user