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
|
|
|
|
2013-04-01 16:28:26 -04:00
|
|
|
Discourse.ajax({
|
2013-03-01 14:22:54 -05:00
|
|
|
type: 'POST',
|
2013-03-14 08:01:52 -04:00
|
|
|
url: Discourse.getURL('/auth/persona/callback'),
|
2013-03-01 14:22:54 -05:00
|
|
|
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>
|