mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-15 04:15:57 +00:00
ajaxify password changer
This commit is contained in:
39
prefs.js
39
prefs.js
@@ -124,13 +124,26 @@ function gethelp_callback() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function notify_callback() {
|
||||
if (xmlhttp.readyState == 4) {
|
||||
notify_info(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function changepass_callback() {
|
||||
if (xmlhttp.readyState == 4) {
|
||||
|
||||
if (xmlhttp.responseText.indexOf("ERROR: ") == 0) {
|
||||
notify_error(xmlhttp.responseText.replace("ERROR: ", ""));
|
||||
} else {
|
||||
notify_info(xmlhttp.responseText);
|
||||
}
|
||||
|
||||
document.forms['change_pass_form'].reset();
|
||||
}
|
||||
}
|
||||
|
||||
function updateFeedList(sort_key) {
|
||||
|
||||
if (!xmlhttp_ready(xmlhttp)) {
|
||||
@@ -1585,4 +1598,28 @@ function showFeedsWithErrors() {
|
||||
displayDlg('feedUpdateErrors');
|
||||
}
|
||||
|
||||
function changeUserPassword() {
|
||||
|
||||
try {
|
||||
|
||||
if (!xmlhttp_ready(xmlhttp)) {
|
||||
printLockingError();
|
||||
return false;
|
||||
}
|
||||
|
||||
var query = Form.serialize("change_pass_form");
|
||||
|
||||
notify_progress("Trying to change password...");
|
||||
|
||||
xmlhttp.open("POST", "backend.php", true);
|
||||
xmlhttp.onreadystatechange=changepass_callback;
|
||||
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
xmlhttp.send(query);
|
||||
|
||||
} catch (e) {
|
||||
exception_error("changeUserPassword", e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user