]> git.openstreetmap.org Git - osqa.git/blobdiff - forum_modules/facebookauth/authentication.py
OSQA-310, during facebook oauth2 registration check whether the length of the user...
[osqa.git] / forum_modules / facebookauth / authentication.py
index cc34fb5efed1bec27dbecaa7e3fb6bff24b54624..aa54c42ece8d9e4e4e7f916c4594e8688ea4435a 100644 (file)
@@ -64,10 +64,16 @@ class FacebookAuthConsumer(AuthenticationConsumer):
         else:
             username = ''
 
+        # Check whether the length if the email is greater than 75, if it is -- just replace the email
+        # with a blank string variable, otherwise we're going to have trouble with the Django model.
+        email = smart_unicode(json['email'])
+        if len(email) > 75:
+            email = ''
+
         # Return the user data.
         return {
             'username': username,
-            'email': smart_unicode(json['email']),
+            'email': email,
         }
 
 class FacebookAuthContext(ConsumerTemplateContext):