diff --git a/example/rp/index.html b/example/rp/index.html index 9eb54b10869eceb66b082c507ed73ac345c6b516..739df478358ed72416555042b46c75e89b25173b 100644 --- a/example/rp/index.html +++ b/example/rp/index.html @@ -143,9 +143,6 @@ $(document).ready(function() { requiredEmail: requiredEmail }); }); - - // explicitly trigger events at document load - navigator.id.setLoggedInUser(null); }); </script> diff --git a/resources/static/communication_iframe/start.js b/resources/static/communication_iframe/start.js index 1737dff674794a001ea1698c17f90c1d7f8127a4..4d9de7afbdf1921cabcc1e5b9dd8519d1f996d1b 100644 --- a/resources/static/communication_iframe/start.js +++ b/resources/static/communication_iframe/start.js @@ -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' }); });