From: Andrew Dolgov Date: Mon, 20 Aug 2007 11:40:18 +0000 (+0100) Subject: change password form: add client-side validation X-Git-Tag: 1.2.14~11 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=ae661a8cfc4b21a4fa00db56d2e6827da674adca;p=tt-rss.git change password form: add client-side validation --- diff --git a/modules/pref-prefs.php b/modules/pref-prefs.php index 2564f30e..27dfd675 100644 --- a/modules/pref-prefs.php +++ b/modules/pref-prefs.php @@ -316,7 +316,8 @@ owner_uid = ".$_SESSION["uid"]." ORDER BY section_id,short_desc"); - print "
"; + print ""; $lnum = 0; diff --git a/prefs.js b/prefs.js index b233d8a1..2223cd9e 100644 --- a/prefs.js +++ b/prefs.js @@ -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...");