diff options
Diffstat (limited to 'mediagoblin/auth')
-rw-r--r-- | mediagoblin/auth/forms.py | 16 | ||||
-rw-r--r-- | mediagoblin/auth/views.py | 11 |
2 files changed, 18 insertions, 9 deletions
diff --git a/mediagoblin/auth/forms.py b/mediagoblin/auth/forms.py index 917909c5..d1f3c5dc 100644 --- a/mediagoblin/auth/forms.py +++ b/mediagoblin/auth/forms.py @@ -24,21 +24,29 @@ class RegistrationForm(wtforms.Form): _('Username'), [wtforms.validators.Required(), wtforms.validators.Length(min=3, max=30), - wtforms.validators.Regexp(r'^\w+$')]) + wtforms.validators.Regexp(r'^\w+$')], + description=_( + u"This is the name other users will identify you with.")) password = wtforms.PasswordField( _('Password'), [wtforms.validators.Required(), wtforms.validators.Length(min=6, max=30), wtforms.validators.EqualTo( 'confirm_password', - _('Passwords must match.'))]) + _('Passwords must match.'))], + description=_( + u"Try to use a strong password!")) confirm_password = wtforms.PasswordField( _('Confirm password'), - [wtforms.validators.Required()]) + [wtforms.validators.Required()], + description=_( + u"Type it again here to make sure there are no spelling mistakes.")) email = wtforms.TextField( _('Email address'), [wtforms.validators.Required(), - wtforms.validators.Email()]) + wtforms.validators.Email()], + description=_( + u"Your email will never be published.")) class LoginForm(wtforms.Form): diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 4c4a34fd..48c5937c 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -44,11 +44,12 @@ def register(request): if request.method == 'POST' and register_form.validate(): # TODO: Make sure the user doesn't exist already - + username = unicode(request.POST['username'].lower()) + email = unicode(request.POST['email'].lower()) users_with_username = request.db.User.find( - {'username': request.POST['username'].lower()}).count() + {'username': username}).count() users_with_email = request.db.User.find( - {'email': request.POST['email'].lower()}).count() + {'email': email}).count() extra_validation_passes = True @@ -64,8 +65,8 @@ def register(request): if extra_validation_passes: # Create the user user = request.db.User() - user['username'] = request.POST['username'].lower() - user['email'] = request.POST['email'].lower() + user['username'] = username + user['email'] = email user['pw_hash'] = auth_lib.bcrypt_gen_password_hash( request.POST['password']) user.save(validate=True) |