If both the username and the email checks fail, warn about both at the same time
This commit is contained in:
parent
873e4e9d2d
commit
9f6ea47586
@ -50,14 +50,18 @@ def register(request):
|
|||||||
users_with_email = request.db.User.find(
|
users_with_email = request.db.User.find(
|
||||||
{'email': request.POST['email'].lower()}).count()
|
{'email': request.POST['email'].lower()}).count()
|
||||||
|
|
||||||
|
extra_validation_passes = True
|
||||||
|
|
||||||
if users_with_username:
|
if users_with_username:
|
||||||
register_form.username.errors.append(
|
register_form.username.errors.append(
|
||||||
_(u'Sorry, a user with that name already exists.'))
|
_(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(
|
register_form.email.errors.append(
|
||||||
_(u'Sorry, that email address has already been taken.'))
|
_(u'Sorry, that email address has already been taken.'))
|
||||||
|
extra_validation_passes = False
|
||||||
|
|
||||||
else:
|
if extra_validation_passes:
|
||||||
# Create the user
|
# Create the user
|
||||||
user = request.db.User()
|
user = request.db.User()
|
||||||
user['username'] = request.POST['username'].lower()
|
user['username'] = request.POST['username'].lower()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user