From 8753fa742a0f2b378269bb8806281cfc7c87a835 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Fri, 2 May 2014 20:58:43 -0300 Subject: added email prefill with mozilla persona and error reporting for incorrect APP_URL setting --- askbot/deps/django_authopenid/util.py | 8 +++++++- askbot/deps/django_authopenid/views.py | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/askbot/deps/django_authopenid/util.py b/askbot/deps/django_authopenid/util.py index 880dbf9d..a63a13bc 100644 --- a/askbot/deps/django_authopenid/util.py +++ b/askbot/deps/django_authopenid/util.py @@ -882,6 +882,12 @@ def mozilla_persona_get_email_from_assertion(assertion): response = conn.getresponse() if response.status == 200: data = simplejson.loads(response.read()) - return data.get('email') + email = data.get('email') + if email: + return email + else: + message = unicode(data) + message += '\nMost likely base url in /settings/QA_SITE_SETTINGS/ is incorrect' + raise ImproperlyConfigured(message) #todo: nead more feedback to help debug fail cases return None diff --git a/askbot/deps/django_authopenid/views.py b/askbot/deps/django_authopenid/views.py index 09cba6fc..e303ddba 100644 --- a/askbot/deps/django_authopenid/views.py +++ b/askbot/deps/django_authopenid/views.py @@ -546,6 +546,8 @@ def signin(request, template_name='authopenid/signin.html'): login(request, user) return HttpResponseRedirect(next_url) else: + #pre-fill email address with persona registration + request.session['email'] = email return finalize_generic_signin( request, login_provider_name = 'mozilla-persona', -- cgit v1.2.3-1-g7c22