Change the text of the submit button when the password is not valid.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Wed, 3 Sep 2008 19:09:05 +0000 (21:09 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Wed, 3 Sep 2008 19:09:05 +0000 (21:09 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
htdocs/javascript/xorg.js
plugins/compiler.checkpasswd.php
templates/googleapps/index.tpl
templates/platal/acces_smtp.tpl

index f82cc9f..e8b7952 100644 (file)
@@ -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");
     }
 }
index 5c10a2a..599aedc 100644 (file)
@@ -32,15 +32,18 @@ function smarty_compiler_checkpasswd($tag_attrs, &$compiler)
     if (!isset($submit)) {
       $submit = "'submitn'";
     }
+    if (!isset($text)) {
+      $text = "'Changer'";
+    }
 
     return '?><script type="text/javascript" src="javascript/jquery.js" ></script>
               <script type="text/javascript" src="javascript/jquery.color.js" ></script>
               <script type="text/javascript">//<![CDATA[
                 var passwordprompt_name = '.  $prompt . ';
                 var passwordprompt_submit = ' . $submit . ';
-                $(":input[@name=' . $prompt . ']").keyup(function(event) { checkPassword(event.target); });
+                $(":input[@name=' . $prompt . ']").keyup(function(event) { checkPassword(event.target, ' . $text . '); });
                 $(document).ready(function() {
-                  checkPassword($(":input[@name=' . $prompt . ']").get(0));
+                  checkPassword($(":input[@name=' . $prompt . ']").get(0), ' . $text . ');
                 });
               //]]></script>
               <div>
index 9292be0..061cc0e 100644 (file)
             </tr>
             <tr>
               <td class="titre">Sécurité</td>
-              <td>{checkpasswd prompt="nouveau" submit="create_account"}</td>
+              <td>{checkpasswd prompt="nouveau" submit="create_account" text="Créer mon compte !"}</td>
             </tr>
           </table>
           </form>
               </tr>
               <tr>
                 <td class="titre">Sécurité</td>
-                <td>{checkpasswd prompt="nouveau" submit="create_account"}</td>
+                <td>{checkpasswd prompt="nouveau" submit="create_account" text="Créer mon compte !"}</td>
               </tr>
               <tr>
                 <td></td>
index 7e21a31..995d133 100644 (file)
@@ -82,7 +82,7 @@
     </tr>
     <tr>
       <td class="titre">Sécurité</td>
-      <td>{checkpasswd prompt="smtppass1" submit="valid"}</td>
+      <td>{checkpasswd prompt="smtppass1" submit="valid" text="Valider"}</td>
     </tr>
     <tr>
       <td colspan="2" class="center">