From 9f6ea47586f78370c42dc9b45782f398bebf7d2e Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Thu, 11 Aug 2011 20:37:21 -0500 Subject: [PATCH] If both the username and the email checks fail, warn about both at the same time --- mediagoblin/auth/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 91599e47..ce6b5dfc 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -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() -- 2.25.1