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 () {
37
37
const shouldLogout = qs [ 'logout' ] ;
38
38
const regSource = qs [ 'regSource' ] ;
39
39
const utmSource = qs [ 'utm_source' ] ;
40
+ const loggerMode = "dev" ;
41
+ const IframeLogoutRequestType = "LOGOUT_REQUEST" ;
40
42
41
43
42
44
var auth0 = null ;
@@ -299,11 +301,24 @@ const authSetup = function () {
299
301
}
300
302
}
301
303
304
+ function logger ( label , message ) {
305
+ if ( loggerMode === "dev" ) {
306
+ console . log ( label , message ) ;
307
+ }
308
+ }
309
+
302
310
/**
303
311
* will receive message from iframe
304
312
*/
305
313
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
+
307
322
}
308
323
309
324
init ( ) ;
You can’t perform that action at this time.
0 commit comments