diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-09-08 08:12:43 -0500 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-09-08 08:12:43 -0500 |
commit | f373599bd745b7afa58013c4b6a17d1c59769cdb (patch) | |
tree | 077aeb3825a2cad6871874d0cfa03bcfcd62fba7 /mediagoblin/auth/forms.py | |
parent | 34fddf47f0b4f7cfa9fbd865bd9eb8ae96913ce4 (diff) | |
parent | f7ab66707c4d5ef5941e13131dbf9ce2a8c7a875 (diff) | |
download | mediagoblin-f373599bd745b7afa58013c4b6a17d1c59769cdb.tar.lz mediagoblin-f373599bd745b7afa58013c4b6a17d1c59769cdb.tar.xz mediagoblin-f373599bd745b7afa58013c4b6a17d1c59769cdb.zip |
Merge branch 'gullydwarf-cfdv-f357_lost_password_functionality'
Conflicts:
mediagoblin/auth/routing.py
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 1dfaf095..6339b4a3 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 _ @@ -51,3 +52,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()]) + |