mirror of
https://github.com/discourse/discourse.git
synced 2026-08-26 21:27:16 -05:00
defer persona init till after people launch the login dialog
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
<!-- 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('/auth/persona/callback', {
|
||||
type: 'POST',
|
||||
data: { 'assertion': assertion },
|
||||
dataType: 'json'
|
||||
}).then(function(data) {
|
||||
Discourse.authenticationComplete(data);
|
||||
});
|
||||
}
|
||||
},
|
||||
onlogout: function() {
|
||||
if (readyCalled) {
|
||||
Discourse.logout();
|
||||
}
|
||||
},
|
||||
onready: function() {
|
||||
readyCalled = true;
|
||||
}
|
||||
});
|
||||
}());
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user