|
|
|
@ -1,6 +1,6 @@
|
|
|
|
import { Component, OnInit, Input } from '@angular/core';
|
|
|
|
import { Component, OnInit, Input } from '@angular/core';
|
|
|
|
import {ButtonSettings} from 'src/app/hmg-common/ui/button/models/button-settingsl';
|
|
|
|
import { ButtonSettings } from 'src/app/hmg-common/ui/button/models/button-settingsl';
|
|
|
|
import {TranslatorService} from 'src/app/hmg-common/services/translator/translator.service';
|
|
|
|
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
|
|
|
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
|
|
|
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
|
|
|
import { LoginRequest } from 'src/app/hmg-common/services/authentication/models/login.request';
|
|
|
|
import { LoginRequest } from 'src/app/hmg-common/services/authentication/models/login.request';
|
|
|
|
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
|
|
|
|
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
|
|
|
|
@ -50,7 +50,7 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
private iosLink: string;
|
|
|
|
private iosLink: string;
|
|
|
|
private androidLink: string;
|
|
|
|
private androidLink: string;
|
|
|
|
public isNFCAvailable = false;
|
|
|
|
public isNFCAvailable = false;
|
|
|
|
direction:string;
|
|
|
|
direction: string;
|
|
|
|
userInfo: any;
|
|
|
|
userInfo: any;
|
|
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
constructor(
|
|
|
|
@ -162,11 +162,11 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
|
|
|
|
console.log(el.value);
|
|
|
|
console.log(el.value);
|
|
|
|
localStorage.setItem("login-type",el.value);
|
|
|
|
localStorage.setItem("login-type", el.value);
|
|
|
|
console.log("login-type: "+ localStorage.getItem("login-type"))
|
|
|
|
console.log("login-type: " + localStorage.getItem("login-type"))
|
|
|
|
if(this.FFloginType == 3 || this.FFloginType == 2 ){
|
|
|
|
if (this.FFloginType == 3 || this.FFloginType == 2) {
|
|
|
|
this.cs.setActiveTypeLogin(el.value);
|
|
|
|
this.cs.setActiveTypeLogin(el.value);
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
this.cs.setActiveTypeLogin(0);
|
|
|
|
this.cs.setActiveTypeLogin(0);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -185,10 +185,10 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
console.log(el.value);
|
|
|
|
console.log(el.value);
|
|
|
|
|
|
|
|
|
|
|
|
localStorage.setItem("login-type",el.value);
|
|
|
|
localStorage.setItem("login-type", el.value);
|
|
|
|
if(this.FFloginType == 3 || this.FFloginType == 2 ){
|
|
|
|
if (this.FFloginType == 3 || this.FFloginType == 2) {
|
|
|
|
this.cs.setActiveTypeLogin(el.value);
|
|
|
|
this.cs.setActiveTypeLogin(el.value);
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
this.cs.setActiveTypeLogin(0);
|
|
|
|
this.cs.setActiveTypeLogin(0);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -230,19 +230,19 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
request.OTP_SendType = type;
|
|
|
|
request.OTP_SendType = type;
|
|
|
|
request.MobileNumber = this.loginData.MobileNumber;
|
|
|
|
request.MobileNumber = this.loginData.MobileNumber;
|
|
|
|
|
|
|
|
|
|
|
|
request.IsMobileFingerPrint =0;
|
|
|
|
request.IsMobileFingerPrint = 0;
|
|
|
|
|
|
|
|
|
|
|
|
request.P_USER_NAME=this.loginData.P_USER_NAME;
|
|
|
|
request.P_USER_NAME = this.loginData.P_USER_NAME;
|
|
|
|
|
|
|
|
|
|
|
|
request.LogInTokenID =this.loginData.LogInTokenID;
|
|
|
|
request.LogInTokenID = this.loginData.LogInTokenID;
|
|
|
|
|
|
|
|
|
|
|
|
request.P_LEGISLATION_CODE =this.loginData.P_LEGISLATION_CODE;//"SA";
|
|
|
|
request.P_LEGISLATION_CODE = this.loginData.P_LEGISLATION_CODE;//"SA";
|
|
|
|
|
|
|
|
|
|
|
|
// request.VersionID ="2.0";
|
|
|
|
// request.VersionID ="2.0";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// request.LanguageID = imeiData && imeiData.PreferredLanguage || request.LanguageID;
|
|
|
|
// request.LanguageID = imeiData && imeiData.PreferredLanguage || request.LanguageID;
|
|
|
|
|
|
|
|
|
|
|
|
this.authService
|
|
|
|
this.authService
|
|
|
|
|
|
|
|
|
|
|
|
@ -259,7 +259,7 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
if (result.isSMSSent) {
|
|
|
|
if (result.isSMSSent) {
|
|
|
|
// tslint:disable-next-line: max-line-length
|
|
|
|
// tslint:disable-next-line: max-line-length
|
|
|
|
this.cs.sharedService.setSharedData({MobileNumber: this.loginData.MobileNumber, loginType: this.selectedOption}, SMSCheckRequest.SHARED_DATA);
|
|
|
|
this.cs.sharedService.setSharedData({ MobileNumber: this.loginData.MobileNumber, loginType: this.selectedOption }, SMSCheckRequest.SHARED_DATA);
|
|
|
|
this.cs.openSMSPage();
|
|
|
|
this.cs.openSMSPage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -293,7 +293,7 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
private presentBiometricDialog() {
|
|
|
|
private presentBiometricDialog() {
|
|
|
|
this.faio.show({
|
|
|
|
this.faio.show({
|
|
|
|
title: 'Biometric Authetnciation', // (Android Only) | optional | Default: "<APP_NAME> Biometric Sign On"
|
|
|
|
title: 'Biometric Authetnciation', // (Android Only) | optional | Default: "<APP_NAME> Biometric Sign On"
|
|
|
|
subtitle: 'Coolest Plugin ever' , // (Android Only) | optional | Default: null
|
|
|
|
subtitle: 'Coolest Plugin ever', // (Android Only) | optional | Default: null
|
|
|
|
description: this.ts.trPK('general', 'auth-please'), // optional | Default: null
|
|
|
|
description: this.ts.trPK('general', 'auth-please'), // optional | Default: null
|
|
|
|
fallbackButtonTitle: this.ts.trPK('general', 'use-pin'), // optional | When disableBackup is false defaults to "Use Pin".
|
|
|
|
fallbackButtonTitle: this.ts.trPK('general', 'use-pin'), // optional | When disableBackup is false defaults to "Use Pin".
|
|
|
|
disableBackup: true, // optional | default: false
|
|
|
|
disableBackup: true, // optional | default: false
|
|
|
|
@ -323,7 +323,7 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
this.authService.getLoginInfo(request, () => { }, this.ts.trPK('general', 'ok')).subscribe((result: GetLoginInfoResponse) => {
|
|
|
|
this.authService.getLoginInfo(request, () => { }, this.ts.trPK('general', 'ok')).subscribe((result: GetLoginInfoResponse) => {
|
|
|
|
if (result.Mohemm_GetMobileLoginInfoList.length > 0) {
|
|
|
|
if (result.Mohemm_GetMobileLoginInfoList.length > 0) {
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
if ( result.Mohemm_GetMobileLoginInfoList[0].LoginType == 2 || result.Mohemm_GetMobileLoginInfoList[0].LoginType == 3) {
|
|
|
|
if (result.Mohemm_GetMobileLoginInfoList[0].LoginType == 2 || result.Mohemm_GetMobileLoginInfoList[0].LoginType == 3) {
|
|
|
|
this.loginTokenID = result.LogInTokenID;
|
|
|
|
this.loginTokenID = result.LogInTokenID;
|
|
|
|
this.checkSMS();
|
|
|
|
this.checkSMS();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -363,7 +363,7 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
request.P_USER_NAME = data.P_USER_NAME;
|
|
|
|
request.P_USER_NAME = data.P_USER_NAME;
|
|
|
|
request.MobileNumber = data.MobileNumber;
|
|
|
|
request.MobileNumber = data.MobileNumber;
|
|
|
|
request.IsDeviceNFC = this.isNFCAvailable;
|
|
|
|
request.IsDeviceNFC = this.isNFCAvailable;
|
|
|
|
this.authService.checkSMS(request, () => {}, this.ts.trPK('general', 'ok'))
|
|
|
|
this.authService.checkSMS(request, () => { }, this.ts.trPK('general', 'ok'))
|
|
|
|
.subscribe((result: SMSCheckResponse) => {
|
|
|
|
.subscribe((result: SMSCheckResponse) => {
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
|
|
|
|
|
|
|
@ -401,12 +401,12 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
request.EmployeeName = this.user_name;
|
|
|
|
request.EmployeeName = this.user_name;
|
|
|
|
this.authService.insertMobileLoginInfo(request, () => { }, this.ts.trPK('general', 'ok'), this.isPostNoLoad)
|
|
|
|
this.authService.insertMobileLoginInfo(request, () => { }, this.ts.trPK('general', 'ok'), this.isPostNoLoad)
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
console.log('successful insertMobileLoginInfo' );
|
|
|
|
console.log('successful insertMobileLoginInfo');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// do silent login
|
|
|
|
// do silent login
|
|
|
|
private checkUserAuthentication() {
|
|
|
|
private checkUserAuthentication() {
|
|
|
|
this.cs.startLoading();
|
|
|
|
this.cs.startLoading();
|
|
|
|
const request = new LoginRequest();
|
|
|
|
const request = new LoginRequest();
|
|
|
|
request.P_USER_NAME = this.username;
|
|
|
|
request.P_USER_NAME = this.username;
|
|
|
|
@ -435,9 +435,9 @@ private checkUserAuthentication() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private handleAppUpdate(result) {
|
|
|
|
private handleAppUpdate(result) {
|
|
|
|
this.iosLink = result.IOSLink;
|
|
|
|
this.iosLink = result.IOSLink;
|
|
|
|
this.androidLink = result.AndroidLink;
|
|
|
|
this.androidLink = result.AndroidLink;
|
|
|
|
if (this.platform.is('android')) {
|
|
|
|
if (this.platform.is('android')) {
|
|
|
|
@ -449,10 +449,10 @@ private handleAppUpdate(result) {
|
|
|
|
window.open(this.iosLink, '_system');
|
|
|
|
window.open(this.iosLink, '_system');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public checkAppUpdated() {
|
|
|
|
public checkAppUpdated() {
|
|
|
|
this.authService.checkApplicationVersion(() => {}).subscribe((result: CheckAppVersionResponse) => {
|
|
|
|
this.authService.checkApplicationVersion(() => { }).subscribe((result: CheckAppVersionResponse) => {
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
if (result.MessageStatus == 2 && result.ErrorType == 4) {
|
|
|
|
if (result.MessageStatus == 2 && result.ErrorType == 4) {
|
|
|
|
this.cs.presentAcceptDialog(result.ErrorEndUserMessage, () => {
|
|
|
|
this.cs.presentAcceptDialog(result.ErrorEndUserMessage, () => {
|
|
|
|
@ -463,29 +463,42 @@ public checkAppUpdated() {
|
|
|
|
this.checkUserAuthentication();
|
|
|
|
this.checkUserAuthentication();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
checkAccess(el: any) {
|
|
|
|
checkAccess(el: any, isDigitalID = false, buttonType?) {
|
|
|
|
const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
|
|
|
|
const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
|
|
|
|
|
|
|
|
if (isDigitalID) {
|
|
|
|
|
|
|
|
this.button();
|
|
|
|
|
|
|
|
this.checkButtonType(buttonType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
console.log(data);
|
|
|
|
this.loginType = el;
|
|
|
|
this.loginType = el;
|
|
|
|
if (this.accessFromOutSide) {
|
|
|
|
if (this.accessFromOutSide) {
|
|
|
|
this.checkAppUpdated();
|
|
|
|
this.checkAppUpdated();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
if (!data == undefined ) {
|
|
|
|
if (!data == undefined) {
|
|
|
|
this.confirm(this.loginType);
|
|
|
|
this.confirm(this.loginType);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.checkAppUpdated();
|
|
|
|
this.checkAppUpdated();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async openDigitalId() {
|
|
|
|
checkButtonType(typeNumber) {
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
let buttonSelected;
|
|
|
|
component: DigitalIdComponent,
|
|
|
|
this.buttons.forEach(element => {
|
|
|
|
cssClass: 'digital-id-modal-css'
|
|
|
|
element.forEach(elementValue => {
|
|
|
|
|
|
|
|
if(typeNumber === elementValue.value){
|
|
|
|
|
|
|
|
buttonSelected = elementValue;
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return await modal.present();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
this.sharedData.setSharedData(true, "loginWithDigitalIDButton");
|
|
|
|
|
|
|
|
this.loginType = buttonSelected;
|
|
|
|
|
|
|
|
this.checkAppUpdated();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|