File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,11 +17,7 @@ export class LogoutPage extends Page {
1717 } , 60000 ) ;
1818
1919 // verify often for an expired session that we expect
20- this . sessionTimeoutInterval = window . setInterval ( ( ) => {
21- if ( Utils . getStorageItem ( "session" , "token" , null ) === null ) {
22- window . clearInterval ( this . sessionTimeoutInterval ) ;
23- return ;
24- }
20+ window . setInterval ( ( ) => {
2521 this . _updateSessionTimeoutWarning ( ) ;
2622 } , 1000 ) ;
2723 }
@@ -57,6 +53,13 @@ export class LogoutPage extends Page {
5753 _updateSessionTimeoutWarning ( ) {
5854 const warning = document . getElementById ( "warning" ) ;
5955
56+ if ( Utils . getStorageItem ( "session" , "token" , null ) === null ) {
57+ // cannot force logout without session
58+ warning . style . display = "" ;
59+ warning . innerText = "No session" ;
60+ return ;
61+ }
62+
6063 const loginResponseStr = Utils . getStorageItem ( "session" , "login-response" , "{}" ) ;
6164 const loginResponse = JSON . parse ( loginResponseStr ) ;
6265
Original file line number Diff line number Diff line change @@ -168,8 +168,11 @@ export class OptionsPanel extends Panel {
168168 durationStr = "\nduration is " + str1 . substr ( 11 , 8 ) ;
169169 }
170170 let expiresInStr = "" ;
171- const str2 = new Date ( pSessionExpire * 1000 - Date . now ( ) ) . toISOString ( ) ;
172- if ( str2 . startsWith ( "1970-01-01T" ) ) {
171+ const leftMillis = pSessionExpire * 1000 - Date . now ( ) ;
172+ if ( leftMillis < 0 ) {
173+ expiresInStr = "\nexpired" ;
174+ } else if ( leftMillis < 86400000 ) {
175+ const str2 = new Date ( leftMillis ) . toISOString ( ) ;
173176 // remove the date prefix and the millisecond suffix
174177 expiresInStr = "\nexpires in " + str2 . substr ( 11 , 8 ) ;
175178 }
You can’t perform that action at this time.
0 commit comments