File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ const authSetup = function () {
3737 const shouldLogout = qs [ 'logout' ] ;
3838 const regSource = qs [ 'regSource' ] ;
3939 const utmSource = qs [ 'utm_source' ] ;
40+ const loggerMode = "dev" ;
41+ const IframeLogoutRequestType = "LOGOUT_REQUEST" ;
4042
4143
4244 var auth0 = null ;
@@ -299,11 +301,24 @@ const authSetup = function () {
299301 }
300302 }
301303
304+ function logger ( label , message ) {
305+ if ( loggerMode === "dev" ) {
306+ console . log ( label , message ) ;
307+ }
308+ }
309+
302310 /**
303311 * will receive message from iframe
304312 */
305313 function receiveMessage ( e ) {
306- console . log ( "received Event:" , e ) ;
314+ logger ( "received Event:" , e ) ;
315+ if ( e . data && e . data . type && e . origin ) {
316+ if ( e . data . type === IframeLogoutRequestType ) {
317+ host = e . origin ;
318+ logout ( ) ;
319+ }
320+ }
321+
307322 }
308323
309324 init ( ) ;
You can’t perform that action at this time.
0 commit comments