|
|
|
@ -12,7 +12,7 @@ import { GetLoginInfoResponse } from '../../hmg-common/services/authentication/m
|
|
|
|
import { SMSCheckRequest } from 'src/app/hmg-common/services/authentication/models/smscheck.request';
|
|
|
|
import { SMSCheckRequest } from 'src/app/hmg-common/services/authentication/models/smscheck.request';
|
|
|
|
import { SMSCheckResponse } from 'src/app/hmg-common/services/authentication/models/smscheck.response';
|
|
|
|
import { SMSCheckResponse } from 'src/app/hmg-common/services/authentication/models/smscheck.response';
|
|
|
|
import { PushService } from 'src/app/hmg-common/services/push/push.service';
|
|
|
|
import { PushService } from 'src/app/hmg-common/services/push/push.service';
|
|
|
|
import { ModalController, Platform } from '@ionic/angular';
|
|
|
|
import { ModalController, Platform, AlertController } from '@ionic/angular';
|
|
|
|
import { CheckUserAuthenticationResponse } from 'src/app/hmg-common/services/authentication/models/check-user-auth.response';
|
|
|
|
import { CheckUserAuthenticationResponse } from 'src/app/hmg-common/services/authentication/models/check-user-auth.response';
|
|
|
|
import { LoginModel } from '../models/LoginModel';
|
|
|
|
import { LoginModel } from '../models/LoginModel';
|
|
|
|
import * as moment from 'moment';
|
|
|
|
import * as moment from 'moment';
|
|
|
|
@ -20,6 +20,8 @@ import { CheckAppVersionResponse } from 'src/app/hmg-common/services/authenticat
|
|
|
|
import { NFC } from "@ionic-native/nfc/ngx";
|
|
|
|
import { NFC } from "@ionic-native/nfc/ngx";
|
|
|
|
import { DigitalIdComponent } from '../digital-id/digital-id.component';
|
|
|
|
import { DigitalIdComponent } from '../digital-id/digital-id.component';
|
|
|
|
import { AppUpdateComponent } from '../app-update/app-update.component';
|
|
|
|
import { AppUpdateComponent } from '../app-update/app-update.component';
|
|
|
|
|
|
|
|
import { Password } from '../models/password';
|
|
|
|
|
|
|
|
import { CheckUserAuthenticationRequest } from 'src/app/hmg-common/services/authentication/models/check-user-auth.request';
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@Component({
|
|
|
|
selector: 'app-confirm-login',
|
|
|
|
selector: 'app-confirm-login',
|
|
|
|
@ -54,7 +56,7 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
direction: string;
|
|
|
|
direction: string;
|
|
|
|
userInfo: any;
|
|
|
|
userInfo: any;
|
|
|
|
public businessInfo: object;
|
|
|
|
public businessInfo: object;
|
|
|
|
|
|
|
|
private checkUserResult: CheckUserAuthenticationResponse;
|
|
|
|
constructor(
|
|
|
|
constructor(
|
|
|
|
public ts: TranslatorService,
|
|
|
|
public ts: TranslatorService,
|
|
|
|
public cs: CommonService,
|
|
|
|
public cs: CommonService,
|
|
|
|
@ -64,6 +66,7 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
public pushService: PushService,
|
|
|
|
public pushService: PushService,
|
|
|
|
public platform: Platform,
|
|
|
|
public platform: Platform,
|
|
|
|
public modalController: ModalController,
|
|
|
|
public modalController: ModalController,
|
|
|
|
|
|
|
|
public alertController: AlertController,
|
|
|
|
private nfc: NFC
|
|
|
|
private nfc: NFC
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
this.loginData = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
|
|
|
|
this.loginData = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
|
|
|
|
@ -446,9 +449,73 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
this.confirm(this.loginType);
|
|
|
|
this.confirm(this.loginType);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (result.IsPasswordExpired) {
|
|
|
|
if (result.IsPasswordExpired) {
|
|
|
|
// alert("dont forget to handelpresentPasswordExpiredDialog() ");
|
|
|
|
this.presentPasswordExpiredDialog();
|
|
|
|
// this.presentPasswordExpiredDialog(); *****
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async presentPasswordExpiredDialog() {
|
|
|
|
|
|
|
|
const alert = await this.alertController.create({
|
|
|
|
|
|
|
|
header: this.ts.trPK('general', 'confirm'),
|
|
|
|
|
|
|
|
message: this.ts.trPK('login', 'password-expired'),
|
|
|
|
|
|
|
|
buttons: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
text: this.ts.trPK('general', 'ok'),
|
|
|
|
|
|
|
|
handler: () => {
|
|
|
|
|
|
|
|
console.log('Confirm Okay');
|
|
|
|
|
|
|
|
this.sharedData.setSharedData(true, Password.IS_EXPIRED_PSW);
|
|
|
|
|
|
|
|
this.userCheck();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
await alert.present();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public userCheck() {
|
|
|
|
|
|
|
|
this.cs.startLoading();
|
|
|
|
|
|
|
|
const request = new CheckUserAuthenticationRequest();
|
|
|
|
|
|
|
|
request.P_USER_NAME = this.username;
|
|
|
|
|
|
|
|
this.authService.checkUserAuthentication(
|
|
|
|
|
|
|
|
request,
|
|
|
|
|
|
|
|
() => {
|
|
|
|
|
|
|
|
/* Write code for error */
|
|
|
|
|
|
|
|
}, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => {
|
|
|
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
|
|
|
this.checkUserResult = result;
|
|
|
|
|
|
|
|
this.cs.stopLoading();
|
|
|
|
|
|
|
|
this.sendSMSForForgotPassword();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private sendSMSForForgotPassword() {
|
|
|
|
|
|
|
|
this.cs.startLoading();
|
|
|
|
|
|
|
|
const changePwdObj = new LoginRequest();
|
|
|
|
|
|
|
|
changePwdObj.MobileNumber = this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER;
|
|
|
|
|
|
|
|
changePwdObj.P_USER_NAME = this.username;
|
|
|
|
|
|
|
|
changePwdObj.P_MOBILE_NUMBER = this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER;
|
|
|
|
|
|
|
|
this.authService.sendPublicSMS(
|
|
|
|
|
|
|
|
changePwdObj,
|
|
|
|
|
|
|
|
() => {
|
|
|
|
|
|
|
|
// this.sendSMSForForgotPassword();
|
|
|
|
|
|
|
|
/* Write code for error */
|
|
|
|
|
|
|
|
}, 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.username;
|
|
|
|
|
|
|
|
// this.loginData.EmployeeName =result.MemberLoginList[0].EMPLOYEE_NAME;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.cs.sharedService.setSharedData(this.loginData.P_USER_NAME, LoginRequest.SHARED_DATA);
|
|
|
|
|
|
|
|
this.sharedData.setSharedData(this.loginData, AuthenticationService.LOGIN_DATA);
|
|
|
|
|
|
|
|
this.sharedData.setSharedData(true, Password.IS_FORGET_PSW);
|
|
|
|
|
|
|
|
this.cs.stopLoading();
|
|
|
|
|
|
|
|
this.cs.openSMSPage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|