1. No session integration yet, so automatic login/logout events are suppressed. 2. Popup blockers must be disabled: submits form to target="_blank"
26 lines
691 B
Plaintext
26 lines
691 B
Plaintext
<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>
|