Feature 11034: Forgot Password in OSM
- Added support for forgot password from UI
- Added forgot password button in login page
Change-Id: I058a09356c4e2ff5d5b0e883e74f0041d1aaffea
Signed-off-by: SANDHYA.JS <sandhya.j@tataelxsi.co.in>
diff --git a/src/services/AuthGuardService.ts b/src/services/AuthGuardService.ts
index 3e0ef8f..05d3a1e 100644
--- a/src/services/AuthGuardService.ts
+++ b/src/services/AuthGuardService.ts
@@ -49,10 +49,11 @@
// eslint-disable-next-line deprecation/deprecation
return combineLatest(
this.authService.isLoggedIn,
- this.authService.isChangePassword
+ this.authService.isChangePassword,
+ this.authService.isForgotPassword
).pipe(
- map(([isLoggedIn, changePassword]: [boolean, boolean]): boolean => {
- if (changePassword || isLoggedIn) {
+ map(([isLoggedIn, changePassword, forgotPassword]: [boolean, boolean, boolean]): boolean => {
+ if (changePassword || isLoggedIn || forgotPassword) {
return true;
} else {
this.router.navigate(['/login']).catch((): void => {
diff --git a/src/services/AuthenticationService.ts b/src/services/AuthenticationService.ts
index 904c1cf..e839f75 100644
--- a/src/services/AuthenticationService.ts
+++ b/src/services/AuthenticationService.ts
@@ -65,6 +65,9 @@
/** Holds the change password in condition of type BehaviorSubject<boolean> @private */
private changePassword: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
+ /** Holds the forgotpassword in condition of type BehaviorSubject<string> @public */
+ public forgotPassword: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
+
/** Hold Rest Service Objects */
private restService: RestService;
@@ -116,6 +119,13 @@
}
/**
+ * Get method for Observable forgotssword
+ */
+ get isForgotPassword(): Observable<boolean> {
+ return this.forgotPassword.asObservable();
+ }
+
+ /**
* Get method for Observable Username
*/
get username(): Observable<string> {
diff --git a/src/services/RestService.ts b/src/services/RestService.ts
index 5f47fb1..e333627 100644
--- a/src/services/RestService.ts
+++ b/src/services/RestService.ts
@@ -157,6 +157,9 @@
} else if (err.error.status === HttpStatus.CONFLICT) {
this.notifierService.notify('error', err.error.detail !== undefined ?
err.error.detail : this.translateService.instant('HTTPERROR.409'));
+ if (sessionStorage.getItem('usertype') !== 'change_password') {
+ this.activeModal.dismissAll();
+ }
this.activeModal.dismissAll();
} else if (err.error.status === HttpStatus.INTERNAL_SERVER_ERROR) {
this.notifierService.notify('error', err.error.detail !== undefined ?
diff --git a/src/services/SharedService.ts b/src/services/SharedService.ts
index 00f0a63..61c3367 100644
--- a/src/services/SharedService.ts
+++ b/src/services/SharedService.ts
@@ -81,6 +81,9 @@
/** Variables to hold regexp pattern for Longitude */
public REGX_LONG_PATTERN: RegExp = new RegExp(/^(\+|-)?(?:180(?:(?:\.0{1,6})?)|(?:[0-9]|[1-9][0-9]|1[0-7][0-9])(?:(?:\.[0-9]{1,15})?))$/);
+ /** Variable to hold regexp pattern for EMAIL */
+ public REGX_EMAIL_PATTERN: RegExp = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
+
/** Variables to hold maxlength for the description @public */
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
public MAX_LENGTH_DESCRIPTION: number = 500;