From 0bf099d7536b5f5f876fa21e4c72f132b7c757a8 Mon Sep 17 00:00:00 2001 From: Alejandro Villanueva Date: Tue, 14 Jun 2011 11:03:56 -0500 Subject: [PATCH] Checks if the email(lowercase) have been used before to register a user --- mediagoblin/auth/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index dc90173e..61164be8 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -47,10 +47,15 @@ def register(request): 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() if users_with_username: register_form.username.errors.append( _(u'Sorry, a user with that name already exists.')) + elif users_with_email: + register_form.email.errors.append( + _(u'Sorry, that email address has already been taken.')) else: # Create the user -- 2.25.1