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/app/utilities/change-password/ChangePasswordComponent.ts b/src/app/utilities/change-password/ChangePasswordComponent.ts
index 2b32a8b..ad2fa32 100644
--- a/src/app/utilities/change-password/ChangePasswordComponent.ts
+++ b/src/app/utilities/change-password/ChangePasswordComponent.ts
@@ -19,6 +19,7 @@
* @file change password component
*/
import { Component, Injector, OnInit } from '@angular/core';
+import { Router } from '@angular/router';
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { TranslateService } from '@ngx-translate/core';
import { AddEditUserComponent } from 'AddEditUserComponent';
@@ -50,11 +51,14 @@
/** Instance of the modal service @private */
private modalService: NgbModal;
+ /** Holds the instance of router class @private */
+ private router: Router;
constructor(injector: Injector) {
this.injector = injector;
this.translateService = this.injector.get(TranslateService);
this.sharedService = this.injector.get(SharedService);
this.modalService = this.injector.get(NgbModal);
+ this.router = this.injector.get(Router);
}
/** Lifecyle Hooks the trigger before component is instantiate @public */
@@ -65,6 +69,14 @@
if (this.editType === 'changePassword') {
modalRef.componentInstance.userTitle = this.translateService.instant('PAGE.USERS.EDITCREDENTIALS');
}
+ if (this.router.url === '/forgotpassword') {
+ this.editType = 'forgotPassword';
+ modalRef.componentInstance.userTitle = this.translateService.instant('PAGE.USERS.FORGOT');
+ }
+ if (this.router.url.startsWith('/forgotpassword/changepassword/')) {
+ this.editType = 'change_password';
+ modalRef.componentInstance.userTitle = this.translateService.instant('PAGE.USERS.EDITCREDENTIALS');
+ }
modalRef.componentInstance.userType = this.editType;
modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => {
if (result) {
diff --git a/src/app/utilities/users-action/UsersActionComponent.html b/src/app/utilities/users-action/UsersActionComponent.html
index 69bf2ab..ca5affe 100644
--- a/src/app/utilities/users-action/UsersActionComponent.html
+++ b/src/app/utilities/users-action/UsersActionComponent.html
@@ -33,6 +33,10 @@
placement="left" container="body" ngbTooltip="{{'PAGE.USERS.EDITUSERNAME' | translate}}">
<i class="fas fa-user-edit"></i> {{'PAGE.USERS.EDITUSERNAME' | translate}}
</button>
+ <button type="button" class="btn btn-primary dropdown-item" (click)="editUserModal('editmail')"
+ placement="left" container="body" ngbTooltip="{{'PAGE.USERS.CHANGEMAIL' | translate}}">
+ <i class="fas fa-envelope"></i> {{'PAGE.USERS.CHANGEMAIL' | translate}}
+ </button>
<button type="button" class="btn btn-primary dropdown-item" (click)="projectRolesModal()" placement="left"
container="body" ngbTooltip="{{'PAGE.USERS.PROJECTSROLES' | translate}}">
<i class="fas fa-user-check"></i> {{'PAGE.USERS.PROJECTSROLES' | translate}}
diff --git a/src/app/utilities/users-action/UsersActionComponent.ts b/src/app/utilities/users-action/UsersActionComponent.ts
index a7b4c24..4f45f81 100644
--- a/src/app/utilities/users-action/UsersActionComponent.ts
+++ b/src/app/utilities/users-action/UsersActionComponent.ts
@@ -100,11 +100,14 @@
modalRef.componentInstance.userID = this.value.identifier;
if (editType === 'editPassword') {
modalRef.componentInstance.userTitle = this.translateService.instant('PAGE.USERS.EDITCREDENTIALS');
+ } else if (editType === 'editmail') {
+ modalRef.componentInstance.userTitle = this.translateService.instant('PAGE.USERS.CHANGEMAIL');
} else {
modalRef.componentInstance.userTitle = this.translateService.instant('PAGE.USERS.EDITUSERNAME');
}
modalRef.componentInstance.userType = editType;
modalRef.componentInstance.userName = this.value.username;
+ modalRef.componentInstance.email = this.value.email_id;
modalRef.result.then((result: MODALCLOSERESPONSEDATA) => {
if (result) {
this.sharedService.callData();