mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-28 01:56:01 -05:00
32 lines
828 B
Text
32 lines
828 B
Text
<!-- TODO, move this into login UI, don't deliver with page -->
|
|
<script>
|
|
$LAB.script("https://login.persona.org/include.js").wait(function(){
|
|
(function() {
|
|
var readyCalled = false;
|
|
navigator.id.watch({
|
|
onlogin: function(assertion) {
|
|
if (readyCalled) {
|
|
|
|
Discourse.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>
|