mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-01 03:17:53 -05:00
30 lines
740 B
Text
30 lines
740 B
Text
<script src="https://login.persona.org/include.js"></script>
|
|
<script>
|
|
(function() {
|
|
var readyCalled = false;
|
|
navigator.id.watch({
|
|
onlogin: function(assertion) {
|
|
if (readyCalled) {
|
|
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: Discourse.getURL('/auth/persona/callback'),
|
|
data: { 'assertion': assertion },
|
|
success: function(data, textStatus, jqXHR) {
|
|
Discourse.authenticationComplete(data);
|
|
},
|
|
dataType: 'json'
|
|
});
|
|
}
|
|
},
|
|
onlogout: function() {
|
|
if (readyCalled) {
|
|
Discourse.logout();
|
|
}
|
|
},
|
|
onready: function() {
|
|
readyCalled = true;
|
|
}
|
|
});
|
|
}());
|
|
</script>
|