Skip to content
Snippets Groups Projects
Commit e9e11540 authored by Lloyd Hilaiel's avatar Lloyd Hilaiel
Browse files

when setLoggedInUser is used, surpress events when the site's notion of a...

when setLoggedInUser is used, surpress events when the site's notion of a logged in user is the same as that of browserid
parent f1e45ae2
No related branches found
No related tags found
No related merge requests found
......@@ -143,9 +143,6 @@ $(document).ready(function() {
requiredEmail: requiredEmail
});
});
// explicitly trigger events at document load
navigator.id.setLoggedInUser(null);
});
</script>
......
......@@ -39,8 +39,17 @@
setRemoteOrigin(trans.origin);
user.getSilentAssertion(loggedInUser, function(email, assertion) {
if (email && assertion) chan.notify({ method: 'login', params: assertion });
else chan.notify({ method: 'logout' });
if (email) {
// only send login events when the assertion is defined - when
// the 'loggedInUser' is already logged in, it's false - that is
// when the site already has the user logged in and does not want
// the resources or cost required to generate an assertion
if (assertion) chan.notify({ method: 'login', params: assertion });
} else if (loggedInUser !== null) {
// only send logout events when loggedInUser is not null, which is an
// indicator that the site thinks the user is logged out
chan.notify({ method: 'logout' });
}
}, function(err) {
chan.notify({ method: 'logout' });
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment