From: jordan Date: Sun, 3 Jul 2011 13:52:44 +0000 (+0000) Subject: OSQA-310, during facebook oauth2 registration check whether the length of the user... X-Git-Tag: live~212 X-Git-Url: https://git.openstreetmap.org/osqa.git/commitdiff_plain/cc266e75da29c970544e815dab67b95521ea23b3 OSQA-310, during facebook oauth2 registration check whether the length of the user email is greater than 75 characters, if it is replace the email variable with a blank string, not to have problems with the Django user model (imposed max length -- 75 chars) git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1101 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum_modules/facebookauth/authentication.py b/forum_modules/facebookauth/authentication.py index cc34fb5..aa54c42 100644 --- a/forum_modules/facebookauth/authentication.py +++ b/forum_modules/facebookauth/authentication.py @@ -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):