Checks if the email(lowercase) have been used before to register a user
authorAlejandro Villanueva <admin@ialex.org>
Tue, 14 Jun 2011 16:03:56 +0000 (11:03 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Fri, 12 Aug 2011 01:32:55 +0000 (20:32 -0500)
mediagoblin/auth/views.py

index dc90173e4866f42a011fe72bfe92dcd7a0586db4..61164be84aa781f2c00b785da2b7304da4129abc 100644 (file)
@@ -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