discourse/app/views/common/_persona_javascript.html.erb

26 lines
691 B
Plaintext
Raw Normal View History

<script src="https://login.persona.org/include.js"></script>
<form id="persona_assertion_form" action="/auth/persona/callback" method="post" target="_blank">
<input type='hidden' name='assertion'/>
</form>
<script>
(function() {
var readyCalled = false;
navigator.id.watch({
onlogin: function(assertion) {
if (readyCalled) {
$('#persona_assertion_form input[name=assertion]').val(assertion);
$('#persona_assertion_form').submit();
}
},
onlogout: function() {
if (readyCalled) {
Discourse.logout();
}
},
onready: function() {
readyCalled = true;
}
});
}());
</script>