Isolate JavaScript; add new show_password.js to forgot-password-page as well
authorJef van Schendel <mail@jefvanschendel.nl>
Thu, 29 Dec 2011 21:54:31 +0000 (22:54 +0100)
committerJef van Schendel <mail@jefvanschendel.nl>
Thu, 29 Dec 2011 21:54:31 +0000 (22:54 +0100)
mediagoblin/auth/forms.py
mediagoblin/templates/mediagoblin/auth/change_fp.html
mediagoblin/templates/mediagoblin/auth/register.html

index 4cd3e9d82db7d51076bf9b790b4ee7c4f8ca2595..5a707c7baba59772adb1d9421e65a31cfcfbc757 100644 (file)
@@ -62,13 +62,7 @@ class ChangePassForm(wtforms.Form):
     password = wtforms.PasswordField(
         'Password',
         [wtforms.validators.Required(),
-         wtforms.validators.Length(min=6, max=30),
-         wtforms.validators.EqualTo(
-                'confirm_password',
-                'Passwords must match.')])
-    confirm_password = wtforms.PasswordField(
-        'Confirm password',
-        [wtforms.validators.Required()])
+         wtforms.validators.Length(min=6, max=30)])
     userid = wtforms.HiddenField(
         '',
         [wtforms.validators.Required()])
index 03a6583bbd7c458bd4a55f9a02586696d8237156..e8e64023d2b533c43bd0331a88b84b8cff455f86 100644 (file)
 
 {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
 
+{% block mediagoblin_head %}
+  <script type="text/javascript"
+          src="{{ request.staticdirect('/js/show_password.js') }}"></script>
+{% endblock mediagoblin_head %}
+
 {% block mediagoblin_content %}
 
   <form action="{{ request.urlgen('mediagoblin.auth.verify_forgot_password') }}"
index 73eae0d8f830b501062f3ee48f8d657a6afb81b4..cdc2ea243e9257ef3844e6f6122a7c9e48aa0dbb 100644 (file)
 {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
 
 {% block mediagoblin_head %}
-  <script>
-    $(document).ready(function(){
-      $("#password").after('<input type="text" value="" name="password_clear" id="password_clear" /><label><input type="checkbox" id="password_boolean" />Show password</label>');
-      $('#password_clear').hide();
-      $('#password_boolean').click(function(){
-        if($('#password_boolean').prop("checked")) {
-          $('#password_clear').val($('#password').val());
-          $('#password').hide();
-          $('#password_clear').show();
-        } else {
-          $('#password').val($('#password_clear').val());
-          $('#password_clear').hide();
-          $('#password').show();
-        };
-      });
-      $('#password,#password_clear').keyup(function(){
-        $('#password').val($(this).val());
-        $('#password_clear').val($(this).val());
-      });
-    });
-  </script>
+  <script type="text/javascript"
+          src="{{ request.staticdirect('/js/show_password.js') }}"></script>
 {% endblock mediagoblin_head %}
 
 {% block mediagoblin_content %}