Feature 11034: Forgot Password in OSM
[osm/NG-UI.git] / src / app / utilities / change-password / ChangePasswordComponent.ts
index 2b32a8b..ad2fa32 100644 (file)
@@ -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 @@ export class ChangePasswordComponent implements OnInit {
     /** 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 @@ export class ChangePasswordComponent implements OnInit {
         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) {