diff options
author | Andrew Dolgov <[email protected]> | 2007-03-02 22:10:11 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2007-03-02 22:10:11 +0100 |
commit | 42395d28746c8f6d7493234b1faae2910de5eddb (patch) | |
tree | eb47cac9fef325b0266d34b890a554eb362f80bb /prefs.js | |
parent | e6312f6c977eb1a9572f12ed3868055b3a79cdfc (diff) |
ajaxify change email form
Diffstat (limited to 'prefs.js')
-rw-r--r-- | prefs.js | 50 |
1 files changed, 41 insertions, 9 deletions
@@ -132,16 +132,23 @@ function notify_callback() { function changepass_callback() { - if (xmlhttp.readyState == 4) { - - if (xmlhttp.responseText.indexOf("ERROR: ") == 0) { - notify_error(xmlhttp.responseText.replace("ERROR: ", "")); - } else { - notify_info(xmlhttp.responseText); - } + try { + if (xmlhttp.readyState == 4) { + + if (xmlhttp.responseText.indexOf("ERROR: ") == 0) { + notify_error(xmlhttp.responseText.replace("ERROR: ", "")); + } else { + notify_info(xmlhttp.responseText); + var warn = document.getElementById("default_pass_warning"); + if (warn) warn.style.display = "none"; + } + + document.forms['change_pass_form'].reset(); - document.forms['change_pass_form'].reset(); - } + } + } catch (e) { + exception_error("changepass_callback", e); + } } function updateFeedList(sort_key) { @@ -1623,3 +1630,28 @@ function changeUserPassword() { return false; } +function changeUserEmail() { + + try { + + if (!xmlhttp_ready(xmlhttp)) { + printLockingError(); + return false; + } + + var query = Form.serialize("change_email_form"); + + notify_progress("Trying to change e-mail..."); + + xmlhttp.open("POST", "backend.php", true); + xmlhttp.onreadystatechange=notify_callback; + xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xmlhttp.send(query); + + } catch (e) { + exception_error("changeUserPassword", e); + } + + return false; + +} |