use urlgen
authorRodney Ewing <ewing.rj@gmail.com>
Fri, 16 Aug 2013 18:48:03 +0000 (11:48 -0700)
committerRodney Ewing <ewing.rj@gmail.com>
Fri, 16 Aug 2013 18:48:03 +0000 (11:48 -0700)
mediagoblin/plugins/persona/static/js/persona.js
mediagoblin/plugins/persona/templates/mediagoblin/plugins/persona/persona.html

index a1d0172f919c0616b88d7dc5f9c9df929ec5081f..a6def3982f0dcc89bf580fab53d33aa04692763e 100644 (file)
@@ -32,6 +32,8 @@ $(document).ready(function () {
         signoutLink.onclick = function() { navigator.id.logout(); };
     }
 
+    var logout_url = document.getElementById('_logout_url').value;
+
     navigator.id.watch({
         onlogin: function(assertion) {
             document.getElementById('_assertion').value = assertion;
@@ -39,8 +41,8 @@ $(document).ready(function () {
     },
         onlogout: function() {
             $.ajax({
-                type: 'POST',
-                url: '/auth/logout',
+                type: 'GET',
+                url: logout_url,
                 success: function(res, status, xhr) { window.location.reload(); },
                 error: function(xhr, status, err) { alert("Logout failure: " + err); }
             });
index ec0e1875e730d4951bec465dd89cdf059eb87590..372bd2468dc8fda7118bdc7a12f99a8178052fdb 100644 (file)
@@ -26,5 +26,7 @@
     method="POST">
     {{ csrf_token }}
     <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') }}"/>
   </form>
 {% endblock %}