forgot password completed
parent
a46ebcb357
commit
1d79849787
@ -0,0 +1,33 @@
|
||||
<ion-header>
|
||||
<ion-toolbar class="header-toolbar">
|
||||
<ion-buttons slot="start">
|
||||
<ion-back-button color="light" class="btnBack" ></ion-back-button>
|
||||
</ion-buttons>
|
||||
<ion-title color="light" > {{'login,forgot-password' | translate}}</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
|
||||
|
||||
<ion-content padding>
|
||||
|
||||
<ion-grid>
|
||||
|
||||
<ion-item>
|
||||
<img class="item-icon" src="assets/imgs/username.png" item-start />
|
||||
<ion-label>{{ts.trPK('login','username')}}</ion-label>
|
||||
<ion-input required type="text" [(ngModel)]="P_USER_NAME">
|
||||
</ion-input>
|
||||
</ion-item>
|
||||
|
||||
</ion-grid>
|
||||
<page-trailer [small]="true"></page-trailer>
|
||||
|
||||
|
||||
|
||||
</ion-content>
|
||||
<ion-footer>
|
||||
<div class="centerDiv">
|
||||
<ion-button color="customnavy" ion-button (click)=" userCheck()">{{ts.trPK('login','changepassword')}}</ion-button>
|
||||
</div>
|
||||
</ion-footer>
|
||||
@ -0,0 +1,7 @@
|
||||
.header-toolbar{
|
||||
--background: linear-gradient(45deg, #3ac1f1 0%, #19a163 36%, #19a163 59%, #1a586d 100%);
|
||||
}
|
||||
|
||||
.btnBack{
|
||||
background: transparent;
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CheckUserComponent } from './check-user.component';
|
||||
|
||||
describe('CheckUserComponent', () => {
|
||||
let component: CheckUserComponent;
|
||||
let fixture: ComponentFixture<CheckUserComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CheckUserComponent ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CheckUserComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,98 @@
|
||||
import { Component, OnInit, ViewChild, ChangeDetectorRef, OnDestroy } from '@angular/core';
|
||||
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
||||
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { AlertController } from '@ionic/angular';
|
||||
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
||||
import { CheckUserAuthenticationRequest } from 'src/app/hmg-common/services/authentication/models/check-user-auth.request';
|
||||
import { CheckUserAuthenticationResponse } from 'src/app/hmg-common/services/authentication/models/check-user-auth.response';
|
||||
import { CheckActivationCodeRequest } from 'src/app/hmg-common/services/authentication/models/check-activation-code.request';
|
||||
import { SmsReaderService } from 'src/app/hmg-common/services/sms/sms-reader.service';
|
||||
import { ForgotFileIDResponse } from '../../hmg-common/services/authentication/models/forgot-File-ID.response';
|
||||
import { InternationalMobileComponent } from 'src/app/hmg-common/ui/mobile-number/international-mobile/international-mobile.component';
|
||||
import { CountryCode } from 'src/app/hmg-common/ui/mobile-number/international-mobile/models/country-code.model';
|
||||
import { LoginRequest } from 'src/app/hmg-common/services/authentication/models/login.request';
|
||||
import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
|
||||
import { Password } from '../models/password';
|
||||
import { LoginModel } from '../models/LoginModel';
|
||||
|
||||
@Component({
|
||||
selector: 'app-check-user',
|
||||
templateUrl: './check-user.component.html',
|
||||
styleUrls: ['./check-user.component.scss'],
|
||||
})
|
||||
export class CheckUserComponent implements OnInit,OnDestroy {
|
||||
public P_USER_NAME : string;
|
||||
private loginData = new LoginModel();
|
||||
|
||||
@ViewChild(InternationalMobileComponent) internationlMobile: InternationalMobileComponent;
|
||||
constructor(public cs: CommonService,
|
||||
public authService: AuthenticationService,
|
||||
public router: Router,
|
||||
public alertController: AlertController,
|
||||
public ts: TranslatorService,
|
||||
public smsService: SmsReaderService,
|
||||
public sharedData: SharedDataService,
|
||||
public changeDetector: ChangeDetectorRef) { }
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.smsService.stopSMSMonitoring();
|
||||
}
|
||||
|
||||
public onForgot() {
|
||||
this.sendSMSForForgotPassword();
|
||||
}
|
||||
|
||||
public userCheck()
|
||||
{
|
||||
this.cs.startLoading();
|
||||
const request = new CheckUserAuthenticationRequest();
|
||||
request.P_USER_NAME = this.P_USER_NAME;
|
||||
this.authService.checkUserAuthentication(
|
||||
request,
|
||||
() => {
|
||||
//this.sendSMSForForgotPassword();
|
||||
}, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => {
|
||||
if (this.cs.validResponse(result)) {
|
||||
this.checkUserResult = result;
|
||||
this.cs.stopLoading();
|
||||
this.sendSMSForForgotPassword();
|
||||
|
||||
// if (result.isSMSSent) {
|
||||
// this.startReceivingSMS();
|
||||
// this.presentSMSPasswordDialog();
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private checkUserResult: CheckUserAuthenticationResponse;
|
||||
|
||||
private sendSMSForForgotPassword() {
|
||||
this.cs.startLoading();
|
||||
let changePwdObj= new LoginRequest();
|
||||
changePwdObj.MobileNumber= this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER;
|
||||
changePwdObj.P_USER_NAME=this.P_USER_NAME;
|
||||
changePwdObj.P_MOBILE_NUMBER=this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER;
|
||||
|
||||
this.authService.sendPublicSMS(
|
||||
changePwdObj,
|
||||
() => {
|
||||
this.sendSMSForForgotPassword();
|
||||
}, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => {
|
||||
if (this.cs.validResponse(result)) {
|
||||
this.checkUserResult = result;
|
||||
console.log("2");
|
||||
console.log(result);
|
||||
this.loginData.LogInTokenID = result.LogInTokenID;
|
||||
this.loginData.P_USER_NAME = this.P_USER_NAME;
|
||||
this.sharedData.setSharedData(this.loginData, "logindata");
|
||||
this.sharedData.setSharedData(true,Password.IS_FORGET_PSW);
|
||||
this.cs.stopLoading();
|
||||
this.cs.openSMSPage();
|
||||
}});
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
import { Request } from 'src/app/hmg-common/services/models/request';
|
||||
export class ForgetPassword extends Request {
|
||||
public static IS_FORGET_PSW:string="is_forget_password";
|
||||
public P_NEW_PASSWORD: string;
|
||||
public P_Confirm_NEW_PASSWORD:string;
|
||||
public P_USER_NAME : string;
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
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 IS_FORGET_PWD:boolean;
|
||||
public P_NEW_PASSWORD: string;
|
||||
public P_OLD_PASSWORD:string;
|
||||
public P_Confirm_NEW_PASSWORD:string;
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
|
||||
export class BasicInfo extends Request{
|
||||
public P_EMAIL_ADDRESS:string;
|
||||
public P_MOBILE_NUMBER: string;
|
||||
public P_RETURN_MSG: string;
|
||||
public P_RETURN_STATUS: string;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
export class MemberList {
|
||||
public P_EMAIL_ADDRESS:string;
|
||||
public P_INVALID_LOGIN_MSG: string;
|
||||
public P_MOBILE_NUMBER: string;
|
||||
public P_PASSOWRD_EXPIRED: string;
|
||||
public P_RETURN_MSG: string;
|
||||
public P_RETURN_STATUS: string;
|
||||
public P_SESSION_ID: number;
|
||||
}
|
||||
Loading…
Reference in New Issue