Fix Bug 2380:Static Inactive session timeout for a user
- Backend will sharing timeout data through api. will store it
in sessionstorage & using it in NGUI
- To avoid runtime issues, if did'nt get data from api added
constant value as 1200
Change-Id: Id00fced3ce26d9f9364d58a0d01ecef891f91262
Signed-off-by: SANDHYA.JS <sandhya.j@tataelxsi.co.in>
diff --git a/src/services/AuthenticationService.ts b/src/services/AuthenticationService.ts
index e839f75..9b0f525 100644
--- a/src/services/AuthenticationService.ts
+++ b/src/services/AuthenticationService.ts
@@ -189,6 +189,9 @@
/** set local storage on auth process @public */
public setLocalStorage(data: ProjectModel): void {
+ if (!isNullOrUndefined(data.timeout)) {
+ sessionStorage.setItem('timeout', data.timeout);
+ }
sessionStorage.setItem('id_token', data.id);
sessionStorage.setItem('expires', data.expires.toString());
sessionStorage.setItem('username', data.username);
@@ -209,12 +212,14 @@
this.changePassword.next(false);
const langCode: string = sessionStorage.getItem('languageCode');
const redirecturl: string = isNullOrUndefined(sessionStorage.getItem('returnUrl')) ? '/' : sessionStorage.getItem('returnUrl');
- const osmVersion: string = isNullOrUndefined(sessionStorage.getItem('version')) ? '' : sessionStorage.getItem('version');
+ const osmVersion: string = isNullOrUndefined(sessionStorage.getItem('osmVersion')) ? '' : sessionStorage.getItem('osmVersion');
+ const timeOut: string = isNullOrUndefined(sessionStorage.getItem('timeout')) ? '1200' : sessionStorage.getItem('timeout');
sessionStorage.clear();
sessionStorage.setItem('languageCode', langCode);
sessionStorage.setItem('returnUrl', redirecturl);
sessionStorage.setItem('token_state', null);
sessionStorage.setItem('osmVersion', osmVersion);
+ sessionStorage.setItem('timeout', timeOut);
this.idle.stop();
this.router.navigate(['login']).catch((): void => {
// Catch Navigation Error