use urlgen

This commit is contained in:
Rodney Ewing 2013-08-16 11:48:03 -07:00
parent fb900ef27b
commit fb2f2bece2
2 changed files with 6 additions and 2 deletions

View File

@ -32,6 +32,8 @@ $(document).ready(function () {
signoutLink.onclick = function() { navigator.id.logout(); }; signoutLink.onclick = function() { navigator.id.logout(); };
} }
var logout_url = document.getElementById('_logout_url').value;
navigator.id.watch({ navigator.id.watch({
onlogin: function(assertion) { onlogin: function(assertion) {
document.getElementById('_assertion').value = assertion; document.getElementById('_assertion').value = assertion;
@ -39,8 +41,8 @@ $(document).ready(function () {
}, },
onlogout: function() { onlogout: function() {
$.ajax({ $.ajax({
type: 'POST', type: 'GET',
url: '/auth/logout', url: logout_url,
success: function(res, status, xhr) { window.location.reload(); }, success: function(res, status, xhr) { window.location.reload(); },
error: function(xhr, status, err) { alert("Logout failure: " + err); } error: function(xhr, status, err) { alert("Logout failure: " + err); }
}); });

View File

@ -26,5 +26,7 @@
method="POST"> method="POST">
{{ csrf_token }} {{ csrf_token }}
<input type="hidden" name="assertion" type="text" id="_assertion"/> <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> </form>
{% endblock %} {% endblock %}