|
|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
import { Component, OnInit, Input } from '@angular/core';
|
|
|
|
|
import {ButtonSettings} from 'src/app/hmg-common/ui/button/models/button-settingsl';
|
|
|
|
|
import {TranslatorService} from 'src/app/hmg-common/services/translator/translator.service';
|
|
|
|
|
import { ButtonSettings } from 'src/app/hmg-common/ui/button/models/button-settingsl';
|
|
|
|
|
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.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 { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
|
|
|
|
|
@ -50,7 +50,7 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
|
private iosLink: string;
|
|
|
|
|
private androidLink: string;
|
|
|
|
|
public isNFCAvailable = false;
|
|
|
|
|
direction:string;
|
|
|
|
|
direction: string;
|
|
|
|
|
userInfo: any;
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
@ -63,19 +63,19 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
|
public platform: Platform,
|
|
|
|
|
public modalController: ModalController,
|
|
|
|
|
private nfc: NFC
|
|
|
|
|
) {
|
|
|
|
|
this.loginData = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
|
|
|
|
|
this.deviceToken = this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false);
|
|
|
|
|
// if device token undefind
|
|
|
|
|
) {
|
|
|
|
|
this.loginData = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
|
|
|
|
|
this.deviceToken = this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false);
|
|
|
|
|
// if device token undefind
|
|
|
|
|
|
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
|
if (this.deviceToken == undefined) {
|
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
|
if (this.deviceToken == undefined) {
|
|
|
|
|
this.deviceToken = localStorage.getItem('deviceToken');
|
|
|
|
|
}
|
|
|
|
|
this.lastLogin = this.cs.sharedService.getSharedData(AuthenticationService.LAST_LOGIN, false);
|
|
|
|
|
this.username = localStorage.getItem('user');
|
|
|
|
|
this.password = localStorage.getItem('password');
|
|
|
|
|
this.empname = localStorage.getItem('emp-name');
|
|
|
|
|
this.lastLogin = this.cs.sharedService.getSharedData(AuthenticationService.LAST_LOGIN, false);
|
|
|
|
|
this.username = localStorage.getItem('user');
|
|
|
|
|
this.password = localStorage.getItem('password');
|
|
|
|
|
this.empname = localStorage.getItem('emp-name');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
@ -125,7 +125,7 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
|
icon: 'assets/icon/login/101.png',
|
|
|
|
|
settings: new ButtonSettings(true, true, true, true),
|
|
|
|
|
value: 3,
|
|
|
|
|
disabled: this.isFaceorFinger === 'face' ? false : true,
|
|
|
|
|
disabled: this.isFaceorFinger === 'face' ? false : true,
|
|
|
|
|
visible: this.onlySMSBox,
|
|
|
|
|
buttonClass: 'buttonClassWhite',
|
|
|
|
|
pClass: 'pClassMyFileIconBlack',
|
|
|
|
|
@ -161,16 +161,16 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
|
switch (el.value) {
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
|
|
console.log(el.value);
|
|
|
|
|
localStorage.setItem("login-type",el.value);
|
|
|
|
|
console.log("login-type: "+ localStorage.getItem("login-type"))
|
|
|
|
|
if(this.FFloginType == 3 || this.FFloginType == 2 ){
|
|
|
|
|
this.cs.setActiveTypeLogin(el.value);
|
|
|
|
|
}else{
|
|
|
|
|
this.cs.setActiveTypeLogin(0);
|
|
|
|
|
console.log(el.value);
|
|
|
|
|
localStorage.setItem("login-type", el.value);
|
|
|
|
|
console.log("login-type: " + localStorage.getItem("login-type"))
|
|
|
|
|
if (this.FFloginType == 3 || this.FFloginType == 2) {
|
|
|
|
|
this.cs.setActiveTypeLogin(el.value);
|
|
|
|
|
} else {
|
|
|
|
|
this.cs.setActiveTypeLogin(0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
this.loginWithSMS(el);
|
|
|
|
|
}
|
|
|
|
|
this.loginWithSMS(el);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
@ -183,15 +183,15 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
|
|
|
|
|
console.log(el.value);
|
|
|
|
|
console.log(el.value);
|
|
|
|
|
|
|
|
|
|
localStorage.setItem("login-type",el.value);
|
|
|
|
|
if(this.FFloginType == 3 || this.FFloginType == 2 ){
|
|
|
|
|
this.cs.setActiveTypeLogin(el.value);
|
|
|
|
|
}else{
|
|
|
|
|
this.cs.setActiveTypeLogin(0);
|
|
|
|
|
localStorage.setItem("login-type", el.value);
|
|
|
|
|
if (this.FFloginType == 3 || this.FFloginType == 2) {
|
|
|
|
|
this.cs.setActiveTypeLogin(el.value);
|
|
|
|
|
} else {
|
|
|
|
|
this.cs.setActiveTypeLogin(0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.loginWithWhatsapp(el);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
@ -203,46 +203,46 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
loginWithSMS(el) {
|
|
|
|
|
if (!el.disabled) {
|
|
|
|
|
if (this.loginData.LogInTokenID) {
|
|
|
|
|
this.sendActivationCode(1);
|
|
|
|
|
} else {
|
|
|
|
|
// this.checkUserAuthentication(1);
|
|
|
|
|
// this.checkUserAuthentication();**
|
|
|
|
|
}
|
|
|
|
|
if (this.loginData.LogInTokenID) {
|
|
|
|
|
this.sendActivationCode(1);
|
|
|
|
|
} else {
|
|
|
|
|
// this.checkUserAuthentication(1);
|
|
|
|
|
// this.checkUserAuthentication();**
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loginWithWhatsapp(el) {
|
|
|
|
|
if (!el.disabled) {
|
|
|
|
|
if (this.loginData.LogInTokenID) {
|
|
|
|
|
this.sendActivationCode(2);
|
|
|
|
|
} else {
|
|
|
|
|
// this.checkUserAuthentication(2);
|
|
|
|
|
}
|
|
|
|
|
if (this.loginData.LogInTokenID) {
|
|
|
|
|
this.sendActivationCode(2);
|
|
|
|
|
} else {
|
|
|
|
|
// this.checkUserAuthentication(2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public sendActivationCode(type: number) {
|
|
|
|
|
public sendActivationCode(type: number) {
|
|
|
|
|
const request = new SendActivationByType();
|
|
|
|
|
this.authService.setPublicFields(request);
|
|
|
|
|
request.OTP_SendType = type;
|
|
|
|
|
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.LanguageID = imeiData && imeiData.PreferredLanguage || request.LanguageID;
|
|
|
|
|
// request.LanguageID = imeiData && imeiData.PreferredLanguage || request.LanguageID;
|
|
|
|
|
|
|
|
|
|
this.authService
|
|
|
|
|
|
|
|
|
|
@ -259,7 +259,7 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
|
if (result.isSMSSent) {
|
|
|
|
|
// 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();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@ -293,7 +293,7 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
|
private presentBiometricDialog() {
|
|
|
|
|
this.faio.show({
|
|
|
|
|
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
|
|
|
|
|
fallbackButtonTitle: this.ts.trPK('general', 'use-pin'), // optional | When disableBackup is false defaults to "Use Pin".
|
|
|
|
|
disableBackup: true, // optional | default: false
|
|
|
|
|
@ -302,39 +302,39 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
|
// disableBackup: true, // Only for Android(optional)
|
|
|
|
|
// localizedFallbackTitle: this.ts.trPK("general", "use-pin"), // Only for iOS
|
|
|
|
|
// localizedReason: this.ts.trPK("general", "auth-please") // Only for iOS
|
|
|
|
|
}).then((result: any) => {
|
|
|
|
|
const request = {
|
|
|
|
|
}).then((result: any) => {
|
|
|
|
|
const request = {
|
|
|
|
|
DeviceType: this.cs.getDeviceType(),
|
|
|
|
|
DeviceToken: this.deviceToken
|
|
|
|
|
};
|
|
|
|
|
// this.authService.setPublicFields(request);
|
|
|
|
|
// request.MobileNumber = this.loginData.MobileNumber;
|
|
|
|
|
// request.P_USER_NAME=this.loginData.P_USER_NAME;
|
|
|
|
|
// request.UserName=this.loginData.P_USER_NAME;
|
|
|
|
|
// request.LogInTokenID =this.loginData.LogInTokenID;
|
|
|
|
|
// request.CompanyID =1;//cs=1 , HMG=2
|
|
|
|
|
this.getMobileInfo(request);
|
|
|
|
|
}).catch((error: any) => {
|
|
|
|
|
console.log(error);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
// this.authService.setPublicFields(request);
|
|
|
|
|
// request.MobileNumber = this.loginData.MobileNumber;
|
|
|
|
|
// request.P_USER_NAME=this.loginData.P_USER_NAME;
|
|
|
|
|
// request.UserName=this.loginData.P_USER_NAME;
|
|
|
|
|
// request.LogInTokenID =this.loginData.LogInTokenID;
|
|
|
|
|
// request.CompanyID =1;//cs=1 , HMG=2
|
|
|
|
|
this.getMobileInfo(request);
|
|
|
|
|
}).catch((error: any) => {
|
|
|
|
|
console.log(error);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private getMobileInfo(request: any) {
|
|
|
|
|
this.authService.getLoginInfo(request, () => { }, this.ts.trPK('general', 'ok')).subscribe((result: GetLoginInfoResponse) => {
|
|
|
|
|
if (result.Mohemm_GetMobileLoginInfoList.length > 0) {
|
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
|
if ( result.Mohemm_GetMobileLoginInfoList[0].LoginType == 2 || result.Mohemm_GetMobileLoginInfoList[0].LoginType == 3) {
|
|
|
|
|
this.loginTokenID = result.LogInTokenID;
|
|
|
|
|
this.checkSMS();
|
|
|
|
|
} else {
|
|
|
|
|
this.onlySMSBox = false;
|
|
|
|
|
this.button();
|
|
|
|
|
}
|
|
|
|
|
if (result.Mohemm_GetMobileLoginInfoList.length > 0) {
|
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
|
if (result.Mohemm_GetMobileLoginInfoList[0].LoginType == 2 || result.Mohemm_GetMobileLoginInfoList[0].LoginType == 3) {
|
|
|
|
|
this.loginTokenID = result.LogInTokenID;
|
|
|
|
|
this.checkSMS();
|
|
|
|
|
} else {
|
|
|
|
|
this.onlySMSBox = false;
|
|
|
|
|
this.button();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.onlySMSBox = false;
|
|
|
|
|
this.button();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.onlySMSBox = false;
|
|
|
|
|
this.button();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -348,7 +348,7 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
|
if (err === "NO_NFC") {
|
|
|
|
|
this.isNFCAvailable = false;
|
|
|
|
|
} else if (err === "NFC_DISABLED") {
|
|
|
|
|
this.isNFCAvailable = true;
|
|
|
|
|
this.isNFCAvailable = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.isNFCAvailable = false;
|
|
|
|
|
}
|
|
|
|
|
@ -363,10 +363,10 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
|
request.P_USER_NAME = data.P_USER_NAME;
|
|
|
|
|
request.MobileNumber = data.MobileNumber;
|
|
|
|
|
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) => {
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Wifi Credientials
|
|
|
|
|
CommonService.MOHEMM_WIFI_SSID = result.Mohemm_Wifi_SSID;
|
|
|
|
|
CommonService.MOHEMM_WIFI_PASSWORD = result.Mohemm_Wifi_Password;
|
|
|
|
|
@ -375,7 +375,7 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
|
this.authService.setAuthenticatedUser(result).subscribe(() => {
|
|
|
|
|
localStorage.setItem('emp-name', result.MemberInformationList[0].EMPLOYEE_NAME);
|
|
|
|
|
this.user_name = result.MemberInformationList[0].EMPLOYEE_NAME;
|
|
|
|
|
const currDateTime = moment().format('MMM DD , YYYY HH:mm');
|
|
|
|
|
const currDateTime = moment().format('MMM DD , YYYY HH:mm');
|
|
|
|
|
localStorage.setItem('login-at', currDateTime);
|
|
|
|
|
if (this.platform.is('cordova')) {
|
|
|
|
|
this.insertMobileLogin();
|
|
|
|
|
@ -401,91 +401,104 @@ export class ConfirmLoginComponent implements OnInit {
|
|
|
|
|
request.EmployeeName = this.user_name;
|
|
|
|
|
this.authService.insertMobileLoginInfo(request, () => { }, this.ts.trPK('general', 'ok'), this.isPostNoLoad)
|
|
|
|
|
.subscribe((result: any) => {
|
|
|
|
|
console.log('successful insertMobileLoginInfo' );
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
console.log('successful insertMobileLoginInfo');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// do silent login
|
|
|
|
|
private checkUserAuthentication() {
|
|
|
|
|
this.cs.startLoading();
|
|
|
|
|
const request = new LoginRequest();
|
|
|
|
|
request.P_USER_NAME = this.username;
|
|
|
|
|
request.P_LANGUAGE = 'US'; // this.language;
|
|
|
|
|
request.P_PASSWORD = this.password;
|
|
|
|
|
this.authService
|
|
|
|
|
// do silent login
|
|
|
|
|
private checkUserAuthentication() {
|
|
|
|
|
this.cs.startLoading();
|
|
|
|
|
const request = new LoginRequest();
|
|
|
|
|
request.P_USER_NAME = this.username;
|
|
|
|
|
request.P_LANGUAGE = 'US'; // this.language;
|
|
|
|
|
request.P_PASSWORD = this.password;
|
|
|
|
|
this.authService
|
|
|
|
|
.login(request, () => {
|
|
|
|
|
console.log('error here');
|
|
|
|
|
console.log('error here');
|
|
|
|
|
}, this.ts.trPK('general', 'ok'))
|
|
|
|
|
.subscribe((result: CheckUserAuthenticationResponse) => {
|
|
|
|
|
console.log('success');
|
|
|
|
|
this.cs.stopLoading();
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
this.loginData = new LoginModel();
|
|
|
|
|
this.loginData.LogInTokenID = result.LogInTokenID;
|
|
|
|
|
this.loginData.MobileNumber = result.MemberLoginList.P_MOBILE_NUMBER;
|
|
|
|
|
this.loginData.P_USER_NAME = this.username;
|
|
|
|
|
this.loginData.EmployeeName = this.user_name;
|
|
|
|
|
this.sharedData.setSharedData(this.loginData, AuthenticationService.LOGIN_DATA);
|
|
|
|
|
this.cs.sharedService.setSharedData(this.loginData.P_USER_NAME, LoginRequest.SHARED_DATA);
|
|
|
|
|
this.confirm(this.loginType);
|
|
|
|
|
} else {
|
|
|
|
|
if (result.IsPasswordExpired) {
|
|
|
|
|
// alert("dont forget to handelpresentPasswordExpiredDialog() ");
|
|
|
|
|
// this.presentPasswordExpiredDialog(); *****
|
|
|
|
|
}
|
|
|
|
|
console.log('success');
|
|
|
|
|
this.cs.stopLoading();
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
this.loginData = new LoginModel();
|
|
|
|
|
this.loginData.LogInTokenID = result.LogInTokenID;
|
|
|
|
|
this.loginData.MobileNumber = result.MemberLoginList.P_MOBILE_NUMBER;
|
|
|
|
|
this.loginData.P_USER_NAME = this.username;
|
|
|
|
|
this.loginData.EmployeeName = this.user_name;
|
|
|
|
|
this.sharedData.setSharedData(this.loginData, AuthenticationService.LOGIN_DATA);
|
|
|
|
|
this.cs.sharedService.setSharedData(this.loginData.P_USER_NAME, LoginRequest.SHARED_DATA);
|
|
|
|
|
this.confirm(this.loginType);
|
|
|
|
|
} else {
|
|
|
|
|
if (result.IsPasswordExpired) {
|
|
|
|
|
// alert("dont forget to handelpresentPasswordExpiredDialog() ");
|
|
|
|
|
// this.presentPasswordExpiredDialog(); *****
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private handleAppUpdate(result) {
|
|
|
|
|
this.iosLink = result.IOSLink;
|
|
|
|
|
this.androidLink = result.AndroidLink;
|
|
|
|
|
if (this.platform.is('android')) {
|
|
|
|
|
private handleAppUpdate(result) {
|
|
|
|
|
this.iosLink = result.IOSLink;
|
|
|
|
|
this.androidLink = result.AndroidLink;
|
|
|
|
|
if (this.platform.is('android')) {
|
|
|
|
|
if (this.androidLink) {
|
|
|
|
|
window.open(this.androidLink, '_system');
|
|
|
|
|
window.open(this.androidLink, '_system');
|
|
|
|
|
}
|
|
|
|
|
} else if (this.platform.is('ios')) {
|
|
|
|
|
} else if (this.platform.is('ios')) {
|
|
|
|
|
if (this.iosLink) {
|
|
|
|
|
window.open(this.iosLink, '_system');
|
|
|
|
|
window.open(this.iosLink, '_system');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public checkAppUpdated() {
|
|
|
|
|
this.authService.checkApplicationVersion(() => {}).subscribe((result: CheckAppVersionResponse) => {
|
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
|
if (result.MessageStatus == 2 && result.ErrorType == 4) {
|
|
|
|
|
this.cs.presentAcceptDialog(result.ErrorEndUserMessage, () => {
|
|
|
|
|
this.handleAppUpdate(result);
|
|
|
|
|
});
|
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
|
} else if (result.MessageStatus == 1) {
|
|
|
|
|
this.checkUserAuthentication();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkAccess(el: any) {
|
|
|
|
|
const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
|
|
|
|
|
this.loginType = el;
|
|
|
|
|
if (this.accessFromOutSide) {
|
|
|
|
|
this.checkAppUpdated();
|
|
|
|
|
} else {
|
|
|
|
|
public checkAppUpdated() {
|
|
|
|
|
this.authService.checkApplicationVersion(() => { }).subscribe((result: CheckAppVersionResponse) => {
|
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
|
if (!data == undefined ) {
|
|
|
|
|
this.confirm(this.loginType);
|
|
|
|
|
} else {
|
|
|
|
|
if (result.MessageStatus == 2 && result.ErrorType == 4) {
|
|
|
|
|
this.cs.presentAcceptDialog(result.ErrorEndUserMessage, () => {
|
|
|
|
|
this.handleAppUpdate(result);
|
|
|
|
|
});
|
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
|
} else if (result.MessageStatus == 1) {
|
|
|
|
|
this.checkUserAuthentication();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkAccess(el: any, isDigitalID = false, buttonType?) {
|
|
|
|
|
const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
|
|
|
|
|
if (isDigitalID) {
|
|
|
|
|
this.button();
|
|
|
|
|
this.checkButtonType(buttonType);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
console.log(data);
|
|
|
|
|
this.loginType = el;
|
|
|
|
|
if (this.accessFromOutSide) {
|
|
|
|
|
this.checkAppUpdated();
|
|
|
|
|
} else {
|
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
|
if (!data == undefined) {
|
|
|
|
|
this.confirm(this.loginType);
|
|
|
|
|
} else {
|
|
|
|
|
this.checkAppUpdated();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async openDigitalId() {
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: DigitalIdComponent,
|
|
|
|
|
cssClass: 'digital-id-modal-css'
|
|
|
|
|
});
|
|
|
|
|
return await modal.present();
|
|
|
|
|
}
|
|
|
|
|
checkButtonType(typeNumber) {
|
|
|
|
|
let buttonSelected;
|
|
|
|
|
this.buttons.forEach(element => {
|
|
|
|
|
element.forEach(elementValue => {
|
|
|
|
|
if(typeNumber === elementValue.value){
|
|
|
|
|
buttonSelected = elementValue;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
this.sharedData.setSharedData(true, "loginWithDigitalIDButton");
|
|
|
|
|
this.loginType = buttonSelected;
|
|
|
|
|
this.checkAppUpdated();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|