If both the username and the email checks fail, warn about both at the same time
authorChristopher Allan Webber <cwebber@dustycloud.org>
Fri, 12 Aug 2011 01:37:21 +0000 (20:37 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Fri, 12 Aug 2011 01:37:21 +0000 (20:37 -0500)
mediagoblin/auth/views.py

index 91599e47d2ef30a00a6ee3bd352e3361ff92ef1c..ce6b5dfc5fb7d423e6a4f6a496da7cbf5fe4a464 100644 (file)
@@ -50,14 +50,18 @@ def register(request):
         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.'))
-        elif users_with_email:
+            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()