aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/auth/views.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2011-08-11 22:54:11 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2011-08-11 22:54:11 -0500
commitba4858c5b4f639d0438b7a6d53a7a731424a430d (patch)
tree69ad17bc78d0b188fd6c9e75d40e4e390ca318fd /mediagoblin/auth/views.py
parent07934b442f7cd3abae18eecdf533de004f88e6b1 (diff)
parent788272f30034fb2f917496197e317226d21aad2e (diff)
downloadmediagoblin-ba4858c5b4f639d0438b7a6d53a7a731424a430d.tar.lz
mediagoblin-ba4858c5b4f639d0438b7a6d53a7a731424a430d.tar.xz
mediagoblin-ba4858c5b4f639d0438b7a6d53a7a731424a430d.zip
Merge branch 'master' into processing
Conflicts: mediagoblin/db/migrations.py
Diffstat (limited to 'mediagoblin/auth/views.py')
-rw-r--r--mediagoblin/auth/views.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py
index 121a8c8e..9120196f 100644
--- a/mediagoblin/auth/views.py
+++ b/mediagoblin/auth/views.py
@@ -45,20 +45,27 @@ def register(request):
if request.method == 'POST' and register_form.validate():
# TODO: Make sure the user doesn't exist already
- users_with_username = \
- request.db.User.find({
- 'username': request.POST['username'].lower()
- }).count()
+ users_with_username = request.db.User.find(
+ {'username': request.POST['username'].lower()}).count()
+ users_with_email = request.db.User.find(
+ {'email': request.POST['email'].lower()}).count()
+
+ extra_validation_passes = True
if users_with_username:
register_form.username.errors.append(
_(u'Sorry, a user with that name already exists.'))
+ extra_validation_passes = False
+ if users_with_email:
+ register_form.email.errors.append(
+ _(u'Sorry, that email address has already been taken.'))
+ extra_validation_passes = False
- else:
+ if extra_validation_passes:
# Create the user
user = request.db.User()
user['username'] = request.POST['username'].lower()
- user['email'] = request.POST['email']
+ user['email'] = request.POST['email'].lower()
user['pw_hash'] = auth_lib.bcrypt_gen_password_hash(
request.POST['password'])
user.save(validate=True)
@@ -159,7 +166,7 @@ def verify_email(request):
return redirect(
request, 'mediagoblin.user_pages.user_home',
- user=request.user['username'])
+ user=user['username'])
def resend_activation(request):