Angular upgrade
[osm/NG-UI.git] / src / app / users / add-user / AddEditUserComponent.ts
index 076cfba..a816c62 100644 (file)
@@ -18,7 +18,6 @@
 /**
  * @file Add Edit Component.
  */
-import { isNullOrUndefined } from 'util';
 import { HttpHeaders } from '@angular/common/http';
 import { Component, Injector, Input, OnInit } from '@angular/core';
 import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
@@ -29,7 +28,7 @@ import { AuthenticationService } from 'AuthenticationService';
 import { APIURLHEADER, ERRORDATA, LOGINPARAMS, MODALCLOSERESPONSEDATA, TYPESECTION } from 'CommonModel';
 import { environment } from 'environment';
 import { RestService } from 'RestService';
-import { SharedService } from 'SharedService';
+import { SharedService, isNullOrUndefined } from 'SharedService';
 
 /**
  * Creating component
@@ -79,7 +78,7 @@ export class AddEditUserComponent implements OnInit {
     public isPassword: boolean;
 
     /** Variable holds value for first login user @public */
-    public isFirstLogin: boolean = Boolean(localStorage.getItem('firstLogin') === 'true');
+    public isFirstLogin: boolean = Boolean(sessionStorage.getItem('firstLogin') === 'true');
 
     /** Instance of the rest service @private */
     private restService: RestService;
@@ -227,6 +226,8 @@ export class AddEditUserComponent implements OnInit {
             if (this.isFirstLogin) {
                 this.notifierService.notify('success', this.translateService.instant('PAGE.USERS.CHANGEPASSWORD'));
                 this.authService.destoryToken();
+            } else if (this.userType === 'changePassword' && (!this.isFirstLogin)) {
+                this.notifierService.notify('success', this.translateService.instant('PAGE.USERS.CHANGEDSUCCESSFULLY'));
             } else {
                 this.notifierService.notify('success', this.translateService.instant('PAGE.USERS.EDITEDSUCCESSFULLY'));
             }
@@ -271,10 +272,10 @@ export class AddEditUserComponent implements OnInit {
 
     /** Method to check loggedin username and update  @private */
     private checkUsername(payLoad: LOGINPARAMS): void {
-        const logUsername: string = localStorage.getItem('username');
+        const logUsername: string = sessionStorage.getItem('username');
         if (this.userType === 'editUserName' && logUsername === this.userName) {
             this.authService.userName.next(payLoad.username);
-            localStorage.setItem('username', payLoad.username);
+            sessionStorage.setItem('username', payLoad.username);
         }
     }
 }