From be9c56adb36c540287419be0ac82ad4da2dd7475 Mon Sep 17 00:00:00 2001 From: ansariakhtar Date: Sun, 30 Jun 2019 15:08:32 +0300 Subject: [PATCH] Change password component added --- .../authentication/authentication.module.ts | 14 +++++++--- .../change-password.component.html | 3 +++ .../change-password.component.scss | 0 .../change-password.component.spec.ts | 27 +++++++++++++++++++ .../change-password.component.ts | 14 ++++++++++ .../authentication/login/login.component.ts | 6 +++++ .../src/app/authentication/models/password.ts | 1 + .../sms-page/sms-page.module.ts | 26 ------------------ .../authentication/sms-page/sms-page.page.ts | 4 ++- .../models/check-activation-code.response.ts | 2 -- .../models/smscheck.response.ts | 2 -- 11 files changed, 64 insertions(+), 35 deletions(-) create mode 100644 Mohem/src/app/authentication/change-password/change-password.component.html create mode 100644 Mohem/src/app/authentication/change-password/change-password.component.scss create mode 100644 Mohem/src/app/authentication/change-password/change-password.component.spec.ts create mode 100644 Mohem/src/app/authentication/change-password/change-password.component.ts delete mode 100644 Mohem/src/app/authentication/sms-page/sms-page.module.ts diff --git a/Mohem/src/app/authentication/authentication.module.ts b/Mohem/src/app/authentication/authentication.module.ts index 80456df0..ab367372 100644 --- a/Mohem/src/app/authentication/authentication.module.ts +++ b/Mohem/src/app/authentication/authentication.module.ts @@ -17,8 +17,9 @@ import { SearchableOptionsModule } from '../hmg-common/ui/searchable-select/sear import { MobileNumberModule } from 'src/app/hmg-common/ui/mobile-number/mobile-number.module'; import { SmsdialogPageModule } from 'src/app/hmg-common/ui/smsdialog/smsdialog.module'; import { SmsPageModule } from 'src/app/hmg-common/ui/sms/sms.module'; -import { SmsPagePage } from './sms-page/sms-page.page'; +import { SmsPageComponent } from './sms-page/sms-page.page'; import { CheckUserComponent } from './check-user/check-user.component'; +import { ChangePasswordComponent } from './change-password/change-password.component'; @@ -41,11 +42,15 @@ const routes: Routes = [ }, { path: 'smspage', - component: SmsPagePage + component: SmsPageComponent }, { path: 'checkuser', component: CheckUserComponent + }, + { + path: 'changepassowrd', + component: ChangePasswordComponent } ] } @@ -70,8 +75,9 @@ const routes: Routes = [ LoginComponent, ForgotComponent, AgreementComponent, - SmsPagePage, - CheckUserComponent + SmsPageComponent, + CheckUserComponent, + ChangePasswordComponent ], providers:[ FingerprintAIO, diff --git a/Mohem/src/app/authentication/change-password/change-password.component.html b/Mohem/src/app/authentication/change-password/change-password.component.html new file mode 100644 index 00000000..b0aa1648 --- /dev/null +++ b/Mohem/src/app/authentication/change-password/change-password.component.html @@ -0,0 +1,3 @@ +

+ change-password works! +

diff --git a/Mohem/src/app/authentication/change-password/change-password.component.scss b/Mohem/src/app/authentication/change-password/change-password.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/authentication/change-password/change-password.component.spec.ts b/Mohem/src/app/authentication/change-password/change-password.component.spec.ts new file mode 100644 index 00000000..e1d15abb --- /dev/null +++ b/Mohem/src/app/authentication/change-password/change-password.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ChangePasswordComponent } from './change-password.component'; + +describe('ChangePasswordComponent', () => { + let component: ChangePasswordComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ChangePasswordComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ChangePasswordComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/authentication/change-password/change-password.component.ts b/Mohem/src/app/authentication/change-password/change-password.component.ts new file mode 100644 index 00000000..fab1531a --- /dev/null +++ b/Mohem/src/app/authentication/change-password/change-password.component.ts @@ -0,0 +1,14 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-change-password', + templateUrl: './change-password.component.html', + styleUrls: ['./change-password.component.scss'], +}) +export class ChangePasswordComponent implements OnInit { + + constructor() { } + + ngOnInit() {} + +} diff --git a/Mohem/src/app/authentication/login/login.component.ts b/Mohem/src/app/authentication/login/login.component.ts index 4e3b310b..6761bff5 100644 --- a/Mohem/src/app/authentication/login/login.component.ts +++ b/Mohem/src/app/authentication/login/login.component.ts @@ -12,6 +12,7 @@ import { SplashScreen } from "@ionic-native/splash-screen/ngx"; import { SharedDataService } from "src/app/hmg-common/services/shared-data-service/shared-data.service"; import { LoginModel } from "../models/LoginModel"; import { LoginRequest } from "src/app/hmg-common/services/authentication/models/login.request"; +import { Password } from '../models/password'; @Component({ selector: "login", @@ -92,6 +93,11 @@ export class LoginComponent implements OnInit, OnDestroy { this.loginData.MobileNumber = result.MemberLoginList.P_MOBILE_NUMBER; this.sharedData.setSharedData(this.loginData, "logindata"); this.cs.stopLoading(); + if(result.MessageStatus === 2) + { + this.sharedData.setSharedData(true,Password.IS_EXPIRED_PSW); + } + this.cs.openSMSPage(); } }); diff --git a/Mohem/src/app/authentication/models/password.ts b/Mohem/src/app/authentication/models/password.ts index 4a160292..28820371 100644 --- a/Mohem/src/app/authentication/models/password.ts +++ b/Mohem/src/app/authentication/models/password.ts @@ -3,6 +3,7 @@ import { Request } from 'src/app/hmg-common/services/models/request'; export class Password extends Request { public static IS_FORGET_PSW:string="is_forget_password"; + public static IS_EXPIRED_PSW:string="is_expired_password"; public IS_FORGET_PWD:boolean; public P_NEW_PASSWORD: string; public P_OLD_PASSWORD:string; diff --git a/Mohem/src/app/authentication/sms-page/sms-page.module.ts b/Mohem/src/app/authentication/sms-page/sms-page.module.ts deleted file mode 100644 index a14a2b6c..00000000 --- a/Mohem/src/app/authentication/sms-page/sms-page.module.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { Routes, RouterModule } from '@angular/router'; - -import { IonicModule } from '@ionic/angular'; - -import { SmsPagePage } from './sms-page.page'; - -const routes: Routes = [ - { - path: '', - component: SmsPagePage - } -]; - -@NgModule({ - imports: [ - CommonModule, - FormsModule, - IonicModule, - RouterModule.forChild(routes) - ], - declarations: [SmsPagePage] -}) -export class SmsPagePageModule {} diff --git a/Mohem/src/app/authentication/sms-page/sms-page.page.ts b/Mohem/src/app/authentication/sms-page/sms-page.page.ts index 24a54baa..bb7b9e80 100644 --- a/Mohem/src/app/authentication/sms-page/sms-page.page.ts +++ b/Mohem/src/app/authentication/sms-page/sms-page.page.ts @@ -15,7 +15,7 @@ import { Password } from "../models/password"; templateUrl: "./sms-page.page.html", styleUrls: ["./sms-page.page.scss"] }) -export class SmsPagePage implements OnInit { +export class SmsPageComponent implements OnInit { public static LOGIN_DATA = "LOGIN_DATA"; Channel: number = 0; activationCode: string; @@ -48,6 +48,8 @@ export class SmsPagePage implements OnInit { this.startTimer(); this.isForgetPwd = this.sharedData.getSharedData(Password.IS_FORGET_PSW) || false; + this.isExpiredPwd = + this.sharedData.getSharedData(Password.IS_EXPIRED_PSW) || false; } initTimer() { diff --git a/Mohem/src/app/hmg-common/services/authentication/models/check-activation-code.response.ts b/Mohem/src/app/hmg-common/services/authentication/models/check-activation-code.response.ts index 019139be..f7718603 100644 --- a/Mohem/src/app/hmg-common/services/authentication/models/check-activation-code.response.ts +++ b/Mohem/src/app/hmg-common/services/authentication/models/check-activation-code.response.ts @@ -13,6 +13,4 @@ export class CheckActivationCodeResponse extends Response { CompanyImageURL: string; MemberInformationList:AuthenticatedUser[]; - CompanyImageDescription: string; - CompanyImageURL : string; } diff --git a/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts b/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts index 447ec734..1ba738fd 100644 --- a/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts +++ b/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts @@ -13,6 +13,4 @@ export class SMSCheckResponse extends Response { public CompanyImageDescription:string; public CompanyImageURL:string; public EMPLOYEE_MOBILE_NUMBER:string; - CompanyImageDescription : string; - CompanyImageURL : string; }