2013-03-01 10:23:21 -05:00
|
|
|
<script src="https://login.persona.org/include.js"></script>
|
|
|
|
<script>
|
|
|
|
(function() {
|
|
|
|
var readyCalled = false;
|
|
|
|
navigator.id.watch({
|
|
|
|
onlogin: function(assertion) {
|
|
|
|
if (readyCalled) {
|
2013-03-01 14:22:54 -05:00
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
|
|
|
url: '/auth/persona/callback',
|
|
|
|
data: { 'assertion': assertion },
|
|
|
|
success: function(data, textStatus, jqXHR) {
|
|
|
|
Discourse.authenticationComplete(data);
|
|
|
|
},
|
|
|
|
dataType: 'json'
|
|
|
|
});
|
2013-03-01 10:23:21 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
onlogout: function() {
|
|
|
|
if (readyCalled) {
|
|
|
|
Discourse.logout();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onready: function() {
|
|
|
|
readyCalled = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}());
|
|
|
|
</script>
|