From 7b7d097083ea303980311887eedd6e65d9e30880 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Wed, 3 Sep 2008 21:09:05 +0200 Subject: [PATCH] Change the text of the submit button when the password is not valid. Signed-off-by: Florent Bruneau --- htdocs/javascript/xorg.js | 4 +++- plugins/compiler.checkpasswd.php | 7 +++++-- templates/googleapps/index.tpl | 4 ++-- templates/platal/acces_smtp.tpl | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/javascript/xorg.js b/htdocs/javascript/xorg.js index f82cc9f..e8b7952 100644 --- a/htdocs/javascript/xorg.js +++ b/htdocs/javascript/xorg.js @@ -299,7 +299,7 @@ function getType(char) { } } -function checkPassword(box) { +function checkPassword(box, okLabel) { var prev = 0; var prop = 0; var pass = box.value; @@ -349,8 +349,10 @@ function checkPassword(box) { .animate({ backgroundColor: bgcolor }, 750); var submitButton = $(":submit[@name='" + passwordprompt_submit + "']"); if (ok && pass.length >= 6) { + submitButton.attr("value", okLabel); submitButton.removeAttr("disabled"); } else { + submitButton.attr("value", "Mot de passe trop faible"); submitButton.attr("disabled", "disabled"); } } diff --git a/plugins/compiler.checkpasswd.php b/plugins/compiler.checkpasswd.php index 5c10a2a..599aedc 100644 --- a/plugins/compiler.checkpasswd.php +++ b/plugins/compiler.checkpasswd.php @@ -32,15 +32,18 @@ function smarty_compiler_checkpasswd($tag_attrs, &$compiler) if (!isset($submit)) { $submit = "'submitn'"; } + if (!isset($text)) { + $text = "'Changer'"; + } return '?>
diff --git a/templates/googleapps/index.tpl b/templates/googleapps/index.tpl index 9292be0..061cc0e 100644 --- a/templates/googleapps/index.tpl +++ b/templates/googleapps/index.tpl @@ -111,7 +111,7 @@ Sécurité - {checkpasswd prompt="nouveau" submit="create_account"} + {checkpasswd prompt="nouveau" submit="create_account" text="Créer mon compte !"} @@ -380,7 +380,7 @@ Sécurité - {checkpasswd prompt="nouveau" submit="create_account"} + {checkpasswd prompt="nouveau" submit="create_account" text="Créer mon compte !"} diff --git a/templates/platal/acces_smtp.tpl b/templates/platal/acces_smtp.tpl index 7e21a31..995d133 100644 --- a/templates/platal/acces_smtp.tpl +++ b/templates/platal/acces_smtp.tpl @@ -82,7 +82,7 @@ Sécurité - {checkpasswd prompt="smtppass1" submit="valid"} + {checkpasswd prompt="smtppass1" submit="valid" text="Valider"} -- 2.1.4