diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2014-05-02 20:58:43 -0300 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2014-05-02 20:58:43 -0300 |
commit | 8753fa742a0f2b378269bb8806281cfc7c87a835 (patch) | |
tree | 0fa5498fc49d6bf7b9c9bdccbed31e76aebaf86c | |
parent | 98e5abb0ad52bfa6467d47d24f7798d9c1d175a7 (diff) | |
download | askbot-8753fa742a0f2b378269bb8806281cfc7c87a835.tar.gz askbot-8753fa742a0f2b378269bb8806281cfc7c87a835.tar.bz2 askbot-8753fa742a0f2b378269bb8806281cfc7c87a835.zip |
added email prefill with mozilla persona and error reporting for incorrect APP_URL setting
-rw-r--r-- | askbot/deps/django_authopenid/util.py | 8 | ||||
-rw-r--r-- | askbot/deps/django_authopenid/views.py | 2 |
2 files changed, 9 insertions, 1 deletions
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', |