need to send the users email to persona if the user logged in with persona.
authorRodney Ewing <ewing.rj@gmail.com>
Wed, 4 Sep 2013 15:35:30 +0000 (08:35 -0700)
committerRodney Ewing <ewing.rj@gmail.com>
Wed, 4 Sep 2013 15:45:08 +0000 (08:45 -0700)
Thanks callahad for pointing this out.

mediagoblin/plugins/persona/static/js/persona.js
mediagoblin/plugins/persona/templates/mediagoblin/plugins/persona/persona.html
mediagoblin/plugins/persona/views.py

index 47006e3b4328482ad910f1393c80fcb209820fd8..76a7757a978b21c96eb5b5c70aa3b41ce64e000f 100644 (file)
@@ -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({
index 372bd2468dc8fda7118bdc7a12f99a8178052fdb..03d63aae20414bc4c0ceeb61855ac10fa449f614 100644 (file)
     <input type="hidden" name="assertion" type="text" id="_assertion"/>
     <input type="hidden" name="_logout_url" type="text" id="_logout_url"
       value="{{ request.urlgen('mediagoblin.auth.logout') }}"/>
+    <input type="hidden" type="text" id="_persona_user"
+      {% if request.session.get('persona_login_email', False) %}
+        value="{{ request.session['persona_login_email'] }}"/>
+      {% else %}
+        value=""/>
+      {% endif %}
   </form>
 {% endblock %}
index 4ea16fa7957346cb88c76003f738dc8714a6ff99..1bba3b8cf1e39fc1997852da05da3f09f32b0267 100644 (file)
@@ -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,