diff options
author | Andrew Dolgov <[email protected]> | 2007-08-20 12:40:18 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2007-08-20 12:40:18 +0100 |
commit | ae661a8cfc4b21a4fa00db56d2e6827da674adca (patch) | |
tree | ae69882e734734afc417341ac860b1e01351b4b0 /prefs.js | |
parent | b652c1b7c4bebf85fbad6d892d8e7ea36e9b2905 (diff) |
change password form: add client-side validation
Diffstat (limited to 'prefs.js')
-rw-r--r-- | prefs.js | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -1684,6 +1684,36 @@ function changeUserPassword() { return false; } + var f = document.forms["change_pass_form"]; + + if (f) { + if (f.OLD_PASSWORD.value == "") { + new Effect.Highlight(f.OLD_PASSWORD); + notify_error("Old password cannot be blank."); + return false; + } + + if (f.NEW_PASSWORD.value == "") { + new Effect.Highlight(f.NEW_PASSWORD); + notify_error("New password cannot be blank."); + return false; + } + + if (f.CONFIRM_PASSWORD.value == "") { + new Effect.Highlight(f.CONFIRM_PASSWORD); + notify_error("Entered passwords do not match."); + return false; + } + + if (f.CONFIRM_PASSWORD.value != f.NEW_PASSWORD.value) { + new Effect.Highlight(f.CONFIRM_PASSWORD); + new Effect.Highlight(f.NEW_PASSWORD); + notify_error("Entered passwords do not match."); + return false; + } + + } + var query = Form.serialize("change_pass_form"); notify_progress("Trying to change password..."); |