diff options
author | Jef van Schendel <mail@jefvanschendel.nl> | 2011-12-02 23:48:40 +0100 |
---|---|---|
committer | Jef van Schendel <mail@jefvanschendel.nl> | 2011-12-02 23:48:40 +0100 |
commit | 0d6e5dddeb38f6af7972485ae186532449719243 (patch) | |
tree | 0c83a3526520fa749b488a98779e711d175a4fb1 | |
parent | 92417fc535c32d905957b4f5ef0fd2cfd8d78609 (diff) | |
download | mediagoblin-0d6e5dddeb38f6af7972485ae186532449719243.tar.lz mediagoblin-0d6e5dddeb38f6af7972485ae186532449719243.tar.xz mediagoblin-0d6e5dddeb38f6af7972485ae186532449719243.zip |
Add show-password checkbox and make it work
-rw-r--r-- | mediagoblin/auth/forms.py | 10 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/auth/register.html | 20 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/base.html | 3 |
3 files changed, 23 insertions, 10 deletions
diff --git a/mediagoblin/auth/forms.py b/mediagoblin/auth/forms.py index dcb6766c..4cd3e9d8 100644 --- a/mediagoblin/auth/forms.py +++ b/mediagoblin/auth/forms.py @@ -29,15 +29,7 @@ class RegistrationForm(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()], - description=_( - u"Type it again here to make sure there are no spelling mistakes.")) + wtforms.validators.Length(min=6, max=30)]) email = wtforms.TextField( _('Email address'), [wtforms.validators.Required(), diff --git a/mediagoblin/templates/mediagoblin/auth/register.html b/mediagoblin/templates/mediagoblin/auth/register.html index a0d0a277..bded1d7e 100644 --- a/mediagoblin/templates/mediagoblin/auth/register.html +++ b/mediagoblin/templates/mediagoblin/auth/register.html @@ -19,6 +19,26 @@ {% 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" /><input type="checkbox" id="password_boolean" />Show password'); + $('#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(); + }; + }); + }); + </script> +{% endblock mediagoblin_head %} + {% block mediagoblin_content %} <form action="{{ request.urlgen('mediagoblin.auth.register') }}" diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html index 29639026..3441365f 100644 --- a/mediagoblin/templates/mediagoblin/base.html +++ b/mediagoblin/templates/mediagoblin/base.html @@ -32,10 +32,11 @@ href="{{ request.staticdirect('/css/video-js.css') }}"/> <link rel="shortcut icon" href="{{ request.staticdirect('/images/goblin.ico') }}" /> + <script type="text/javascript" + src="{{ request.staticdirect('/js/extlib/jquery.js') }}"></script> {% block mediagoblin_head %} {% endblock mediagoblin_head %} </head> - <body> {% block mediagoblin_body %} <div class="mediagoblin_body"> |