diff options
author | Alejandro Villanueva <admin@ialex.org> | 2011-07-21 11:55:41 -0500 |
---|---|---|
committer | Caleb Forbes Davis V <caldavis@gmail.com> | 2011-08-28 20:08:14 -0500 |
commit | 25ba955e20e9262f2599a21d234511b724569717 (patch) | |
tree | 4a6fc14ccd9a426f78f2b16377cdc0699bcc9747 /mediagoblin/auth/forms.py | |
parent | ad56a4826b987a0fa8f65849d3611f61cc1f50d6 (diff) | |
download | mediagoblin-25ba955e20e9262f2599a21d234511b724569717.tar.lz mediagoblin-25ba955e20e9262f2599a21d234511b724569717.tar.xz mediagoblin-25ba955e20e9262f2599a21d234511b724569717.zip |
Adding fotgot password functionality
Diffstat (limited to 'mediagoblin/auth/forms.py')
-rw-r--r-- | mediagoblin/auth/forms.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/mediagoblin/auth/forms.py b/mediagoblin/auth/forms.py index 917909c5..1be74aa6 100644 --- a/mediagoblin/auth/forms.py +++ b/mediagoblin/auth/forms.py @@ -15,6 +15,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import wtforms +import re from mediagoblin.util import fake_ugettext_passthrough as _ @@ -49,3 +50,34 @@ class LoginForm(wtforms.Form): password = wtforms.PasswordField( _('Password'), [wtforms.validators.Required()]) + + +class ForgotPassForm(wtforms.Form): + username = wtforms.TextField( + 'Username or email', + [wtforms.validators.Required()]) + + def validate_username(form,field): + if not (re.match(r'^\w+$',field.data) or + re.match(r'^.+@[^.].*\.[a-z]{2,10}$',field.data, re.IGNORECASE)): + raise wtforms.ValidationError(u'Incorrect input') + + +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()]) + userid = wtforms.HiddenField( + '', + [wtforms.validators.Required()]) + token = wtforms.HiddenField( + '', + [wtforms.validators.Required()]) + |