From 857512e81ef07b67641a429c09b7b7b403a9a2c6 Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Wed, 4 Sep 2013 08:35:30 -0700 Subject: [PATCH] need to send the users email to persona if the user logged in with persona. Thanks callahad for pointing this out. --- mediagoblin/plugins/persona/static/js/persona.js | 4 +++- .../templates/mediagoblin/plugins/persona/persona.html | 6 ++++++ mediagoblin/plugins/persona/views.py | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mediagoblin/plugins/persona/static/js/persona.js b/mediagoblin/plugins/persona/static/js/persona.js index 47006e3b..76a7757a 100644 --- a/mediagoblin/plugins/persona/static/js/persona.js +++ b/mediagoblin/plugins/persona/static/js/persona.js @@ -39,11 +39,13 @@ $(document).ready(function () { } var logout_url = document.getElementById('_logout_url').value; + var persona_user = document.getElementById('_persona_user').value; navigator.id.watch({ + loggedInUser: persona_user || null, onlogin: function(assertion) { document.getElementById('_assertion').value = assertion; - document.getElementById('_persona_login').submit() + document.getElementById('_persona_login').submit(); }, onlogout: function() { $.ajax({ diff --git a/mediagoblin/plugins/persona/templates/mediagoblin/plugins/persona/persona.html b/mediagoblin/plugins/persona/templates/mediagoblin/plugins/persona/persona.html index 372bd246..03d63aae 100644 --- a/mediagoblin/plugins/persona/templates/mediagoblin/plugins/persona/persona.html +++ b/mediagoblin/plugins/persona/templates/mediagoblin/plugins/persona/persona.html @@ -28,5 +28,11 @@ + + {% else %} + value=""/> + {% endif %} {% endblock %} diff --git a/mediagoblin/plugins/persona/views.py b/mediagoblin/plugins/persona/views.py index 4ea16fa7..1bba3b8c 100644 --- a/mediagoblin/plugins/persona/views.py +++ b/mediagoblin/plugins/persona/views.py @@ -64,6 +64,7 @@ def login(request): if user: request.session['user_id'] = unicode(user.id) + request.session['persona_login_email'] = email request.session.save() return redirect(request, "index") @@ -183,6 +184,8 @@ def add(request): new_entry.user_id = request.user.id new_entry.save() + request.session['persona_login_email'] = email + messages.add_message( request, messages.SUCCESS, -- 2.25.1