|
|
|
|
@ -6,7 +6,6 @@ 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 { CheckActivationCodeResponse } from 'src/app/hmg-common/services/authentication/models/check-activation-code.response';
|
|
|
|
|
import { SmsReaderService } from 'src/app/hmg-common/services/sms/sms-reader.service';
|
|
|
|
|
import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user';
|
|
|
|
|
@ -16,8 +15,8 @@ import { GetLoginInfoRequest } from 'src/app/hmg-common/services/authentication/
|
|
|
|
|
import { GetLoginInfoResponse } from 'src/app/hmg-common/services/authentication/models/get-login-info.response';
|
|
|
|
|
import { Device } from '@ionic-native/device/ngx';
|
|
|
|
|
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
|
|
|
|
|
import { CountryCode } from 'src/app/hmg-common/ui/mobile-number/international-mobile/models/country-code.model';
|
|
|
|
|
import { SMSService } from 'src/app/hmg-common/ui/sms/service/smsservice';
|
|
|
|
|
import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
|
|
|
|
|
import { LoginModel } from '../models/LoginModel';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'login',
|
|
|
|
|
@ -31,11 +30,16 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
isSupportAr:boolean=false;
|
|
|
|
|
isAppleStore:boolean=false;
|
|
|
|
|
memberLogin: any = {};
|
|
|
|
|
private currentLang : any;
|
|
|
|
|
|
|
|
|
|
private password: string;
|
|
|
|
|
private language: string;
|
|
|
|
|
private username : string;
|
|
|
|
|
private currentLang : any = 2;
|
|
|
|
|
private patientOutSA: boolean;
|
|
|
|
|
private loginTokenID: string;
|
|
|
|
|
private isMobileFingerPrint: boolean;
|
|
|
|
|
private FingerPrintPatientIdentificationID: string;
|
|
|
|
|
private loginData = new LoginModel();
|
|
|
|
|
constructor(
|
|
|
|
|
public cs: CommonService,
|
|
|
|
|
public authService: AuthenticationService,
|
|
|
|
|
@ -46,17 +50,19 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
private faio: FingerprintAIO,
|
|
|
|
|
public ngZone: NgZone,
|
|
|
|
|
public device: Device,
|
|
|
|
|
public splash: SplashScreen
|
|
|
|
|
public splash: SplashScreen,
|
|
|
|
|
public sharedData: SharedDataService
|
|
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
console.log(this.currentLang);
|
|
|
|
|
//this.setIdPattern();
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.checkIfLoggedInBefore();
|
|
|
|
|
// this.splash.hide();
|
|
|
|
|
}, 100);
|
|
|
|
|
this.currentLang = TranslatorService.getCurrentLanguageCode();
|
|
|
|
|
// setTimeout(() => {
|
|
|
|
|
// this.checkIfLoggedInBefore();
|
|
|
|
|
// // this.splash.hide();
|
|
|
|
|
// }, 100);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnDestroy(): void {
|
|
|
|
|
@ -64,20 +70,27 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
}
|
|
|
|
|
public changeLanguage(){
|
|
|
|
|
this.ts.switchLanguage();
|
|
|
|
|
if(TranslatorService.CURRENT_LANGUAGE == TranslatorService.EN)
|
|
|
|
|
{
|
|
|
|
|
this.language = "US";
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
this.language = "AR";
|
|
|
|
|
}
|
|
|
|
|
this.currentLang = TranslatorService.getCurrentLanguageCode();
|
|
|
|
|
console.log(this.currentLang);
|
|
|
|
|
}
|
|
|
|
|
private checkIfLoggedInBefore() {
|
|
|
|
|
this.cs.startLoading();
|
|
|
|
|
// check if user logged in before
|
|
|
|
|
this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => {
|
|
|
|
|
if (user) {
|
|
|
|
|
this.startBiometricLogin(user);
|
|
|
|
|
} else {
|
|
|
|
|
this.hideSplashScreen(true);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// private checkIfLoggedInBefore() {
|
|
|
|
|
// this.cs.startLoading();
|
|
|
|
|
// // check if user logged in before
|
|
|
|
|
// this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => {
|
|
|
|
|
// if (user) {
|
|
|
|
|
// this.startBiometricLogin(user);
|
|
|
|
|
// } else {
|
|
|
|
|
// this.hideSplashScreen(true);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
private forgetPasswordPage(){
|
|
|
|
|
this.cs.openUserForgot();
|
|
|
|
|
}
|
|
|
|
|
@ -87,24 +100,24 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
this.cs.stopLoading();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private startBiometricLogin(user: AuthenticatedUser) {
|
|
|
|
|
this.faio.isAvailable().then((options) => {
|
|
|
|
|
this.hideSplashScreen(true);
|
|
|
|
|
if (user.biometricEnabled) {
|
|
|
|
|
// ask if login with face or finger
|
|
|
|
|
this.cs.presentConfirmDialog(
|
|
|
|
|
this.ts.trPK('login', options),
|
|
|
|
|
() => this.presentBiometricDialog(user),
|
|
|
|
|
() => { }
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
// ask to enable biometric
|
|
|
|
|
this.getPermissionToActivateBiometric(user);
|
|
|
|
|
}
|
|
|
|
|
}, () => {
|
|
|
|
|
this.hideSplashScreen(true);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// private startBiometricLogin(user: AuthenticatedUser) {
|
|
|
|
|
// this.faio.isAvailable().then((options) => {
|
|
|
|
|
// this.hideSplashScreen(true);
|
|
|
|
|
// if (user.biometricEnabled) {
|
|
|
|
|
// // ask if login with face or finger
|
|
|
|
|
// this.cs.presentConfirmDialog(
|
|
|
|
|
// this.ts.trPK('login', options),
|
|
|
|
|
// () => this.presentBiometricDialog(user),
|
|
|
|
|
// () => { }
|
|
|
|
|
// );
|
|
|
|
|
// } else {
|
|
|
|
|
// // ask to enable biometric
|
|
|
|
|
// this.getPermissionToActivateBiometric(user);
|
|
|
|
|
// }
|
|
|
|
|
// }, () => {
|
|
|
|
|
// this.hideSplashScreen(true);
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
private getPermissionToActivateBiometric(user: AuthenticatedUser) {
|
|
|
|
|
this.cs.presentConfirmDialog(
|
|
|
|
|
@ -143,10 +156,10 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
|
|
|
|
private initializeForAuthentictedUser(user: AuthenticatedUser) {
|
|
|
|
|
this.ngZone.run(() => {
|
|
|
|
|
this.isMobileFingerPrint = true;
|
|
|
|
|
this.FingerPrintPatientIdentificationID = user.IdentificationNo;
|
|
|
|
|
this.mobileNumber = user.MobileNumber;
|
|
|
|
|
this.zipCode = CountryCode.localCode(user.ZipCode);
|
|
|
|
|
//this.isMobileFingerPrint = true;
|
|
|
|
|
//this.FingerPrintPatientIdentificationID = user.IdentificationNo;
|
|
|
|
|
//this.mobileNumber = user.MobileNumber;
|
|
|
|
|
//this.zipCode = CountryCode.localCode(user.ZipCode);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -165,16 +178,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
}).catch((error: any) => console.log(error));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
we need holders here since the country code maybe is not loaded yet for automatic login
|
|
|
|
|
*/
|
|
|
|
|
private mobileNumber: string;
|
|
|
|
|
private zipCode: string;
|
|
|
|
|
|
|
|
|
|
public onLogin() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.checkUserAuthentication();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -183,165 +187,165 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public loginWithMyAccount() {
|
|
|
|
|
// this.loginWithTamer();
|
|
|
|
|
this.loginWithTamer();
|
|
|
|
|
}
|
|
|
|
|
// public loginWithMyAccount() {
|
|
|
|
|
// // this.loginWithTamer();
|
|
|
|
|
// this.loginWithTamer();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
TODO to be removed later
|
|
|
|
|
*/
|
|
|
|
|
public loginWithEnas() {
|
|
|
|
|
alert('you are doing slient login width enas account ');
|
|
|
|
|
const user = new AuthenticatedUser();
|
|
|
|
|
user.PatientID = 862616;
|
|
|
|
|
|
|
|
|
|
user.PatientTypeID = PATIENT_TYPE.PERMANENT;
|
|
|
|
|
user.PatientOutSA = false;
|
|
|
|
|
user.TokenID = '@dm!n';
|
|
|
|
|
user.ProjectID = 0;
|
|
|
|
|
user.NationalityID = '2300948375';
|
|
|
|
|
user.MobileNo = user.MobileNumber = '554355126';
|
|
|
|
|
user.ZipCode = '+966';
|
|
|
|
|
user.Address = 'riyadh';
|
|
|
|
|
user.FirstName = 'MOHAMED';
|
|
|
|
|
user.MiddleName = 'yaghi';
|
|
|
|
|
user.LastName = 'mohammed';
|
|
|
|
|
user.Age = 30;
|
|
|
|
|
user.agreed = true;
|
|
|
|
|
const birthDate = new Date();
|
|
|
|
|
birthDate.setFullYear(birthDate.getFullYear() - 29);
|
|
|
|
|
user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate));
|
|
|
|
|
user.Email = 'Mohamed.Afifi@cloudsolution-sa.com';
|
|
|
|
|
user.PatientName = 'enas yaghi';
|
|
|
|
|
this.authService.updateLoggedInUser(user).subscribe(done => {
|
|
|
|
|
this.authService.startIdleMonitoring();
|
|
|
|
|
this.cs.openHome();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public loginWithVaccineUser() {
|
|
|
|
|
alert('you are doing slient login width vaccine account ');
|
|
|
|
|
const user = new AuthenticatedUser();
|
|
|
|
|
user.PatientID = 862616; // user with vaccines in dev
|
|
|
|
|
|
|
|
|
|
user.PatientTypeID = PATIENT_TYPE.PERMANENT;
|
|
|
|
|
user.PatientOutSA = false;
|
|
|
|
|
user.TokenID = '@dm!n';
|
|
|
|
|
user.NationalityID = '2300948375';
|
|
|
|
|
user.MobileNo = user.MobileNumber = '554355126';
|
|
|
|
|
user.ProjectID = 0;
|
|
|
|
|
user.ZipCode = '+966';
|
|
|
|
|
user.Address = 'riyadh';
|
|
|
|
|
user.FirstName = 'MOHAMED';
|
|
|
|
|
user.MiddleName = 'yaghi';
|
|
|
|
|
user.LastName = 'mohammed';
|
|
|
|
|
user.Age = 30;
|
|
|
|
|
user.agreed = true;
|
|
|
|
|
const birthDate = new Date();
|
|
|
|
|
birthDate.setFullYear(birthDate.getFullYear() - 29);
|
|
|
|
|
user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate));
|
|
|
|
|
user.Email = 'minna.barry@cloudsolution-sa.com';
|
|
|
|
|
user.PatientName = 'enas yaghi';
|
|
|
|
|
this.authService.updateLoggedInUser(user).subscribe(done => {
|
|
|
|
|
this.authService.startIdleMonitoring();
|
|
|
|
|
this.cs.openHome();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public loginWithEyeMeasureUser() {
|
|
|
|
|
alert('you are doing slient login width eye measurements user account ');
|
|
|
|
|
const user = new AuthenticatedUser();
|
|
|
|
|
user.PatientID = 873010;
|
|
|
|
|
|
|
|
|
|
user.PatientTypeID = PATIENT_TYPE.PERMANENT;
|
|
|
|
|
user.PatientOutSA = false;
|
|
|
|
|
user.TokenID = '@dm!n';
|
|
|
|
|
user.NationalityID = '2302581828';
|
|
|
|
|
user.ProjectID = 0;
|
|
|
|
|
user.MobileNo = user.MobileNumber = '555333541';
|
|
|
|
|
user.ZipCode = '+966';
|
|
|
|
|
user.Address = 'riyadh';
|
|
|
|
|
user.FirstName = 'eye';
|
|
|
|
|
user.MiddleName = 'user';
|
|
|
|
|
user.LastName = 'measurment';
|
|
|
|
|
user.Age = 30;
|
|
|
|
|
user.agreed = true;
|
|
|
|
|
const birthDate = new Date();
|
|
|
|
|
birthDate.setFullYear(birthDate.getFullYear() - 29);
|
|
|
|
|
user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate));
|
|
|
|
|
user.Email = 'sultan.khan@hmg.local';
|
|
|
|
|
user.PatientName = 'eye user';
|
|
|
|
|
this.authService.updateLoggedInUser(user).subscribe(done => {
|
|
|
|
|
this.authService.startIdleMonitoring();
|
|
|
|
|
this.cs.openHome();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// public loginWithEnas() {
|
|
|
|
|
// alert('you are doing slient login width enas account ');
|
|
|
|
|
// const user = new AuthenticatedUser();
|
|
|
|
|
// user.PatientID = 862616;
|
|
|
|
|
|
|
|
|
|
// user.PatientTypeID = PATIENT_TYPE.PERMANENT;
|
|
|
|
|
// user.PatientOutSA = false;
|
|
|
|
|
// user.TokenID = '@dm!n';
|
|
|
|
|
// user.ProjectID = 0;
|
|
|
|
|
// user.NationalityID = '2300948375';
|
|
|
|
|
// user.MobileNo = user.MobileNumber = '554355126';
|
|
|
|
|
// user.ZipCode = '+966';
|
|
|
|
|
// user.Address = 'riyadh';
|
|
|
|
|
// user.FirstName = 'MOHAMED';
|
|
|
|
|
// user.MiddleName = 'yaghi';
|
|
|
|
|
// user.LastName = 'mohammed';
|
|
|
|
|
// user.Age = 30;
|
|
|
|
|
// user.agreed = true;
|
|
|
|
|
// const birthDate = new Date();
|
|
|
|
|
// birthDate.setFullYear(birthDate.getFullYear() - 29);
|
|
|
|
|
// user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate));
|
|
|
|
|
// user.Email = 'Mohamed.Afifi@cloudsolution-sa.com';
|
|
|
|
|
// user.PatientName = 'enas yaghi';
|
|
|
|
|
// this.authService.updateLoggedInUser(user).subscribe(done => {
|
|
|
|
|
// this.authService.startIdleMonitoring();
|
|
|
|
|
// this.cs.openHome();
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// public loginWithVaccineUser() {
|
|
|
|
|
// alert('you are doing slient login width vaccine account ');
|
|
|
|
|
// const user = new AuthenticatedUser();
|
|
|
|
|
// user.PatientID = 862616; // user with vaccines in dev
|
|
|
|
|
|
|
|
|
|
// user.PatientTypeID = PATIENT_TYPE.PERMANENT;
|
|
|
|
|
// user.PatientOutSA = false;
|
|
|
|
|
// user.TokenID = '@dm!n';
|
|
|
|
|
// user.NationalityID = '2300948375';
|
|
|
|
|
// user.MobileNo = user.MobileNumber = '554355126';
|
|
|
|
|
// user.ProjectID = 0;
|
|
|
|
|
// user.ZipCode = '+966';
|
|
|
|
|
// user.Address = 'riyadh';
|
|
|
|
|
// user.FirstName = 'MOHAMED';
|
|
|
|
|
// user.MiddleName = 'yaghi';
|
|
|
|
|
// user.LastName = 'mohammed';
|
|
|
|
|
// user.Age = 30;
|
|
|
|
|
// user.agreed = true;
|
|
|
|
|
// const birthDate = new Date();
|
|
|
|
|
// birthDate.setFullYear(birthDate.getFullYear() - 29);
|
|
|
|
|
// user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate));
|
|
|
|
|
// user.Email = 'minna.barry@cloudsolution-sa.com';
|
|
|
|
|
// user.PatientName = 'enas yaghi';
|
|
|
|
|
// this.authService.updateLoggedInUser(user).subscribe(done => {
|
|
|
|
|
// this.authService.startIdleMonitoring();
|
|
|
|
|
// this.cs.openHome();
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// public loginWithEyeMeasureUser() {
|
|
|
|
|
// alert('you are doing slient login width eye measurements user account ');
|
|
|
|
|
// const user = new AuthenticatedUser();
|
|
|
|
|
// user.PatientID = 873010;
|
|
|
|
|
|
|
|
|
|
// user.PatientTypeID = PATIENT_TYPE.PERMANENT;
|
|
|
|
|
// user.PatientOutSA = false;
|
|
|
|
|
// user.TokenID = '@dm!n';
|
|
|
|
|
// user.NationalityID = '2302581828';
|
|
|
|
|
// user.ProjectID = 0;
|
|
|
|
|
// user.MobileNo = user.MobileNumber = '555333541';
|
|
|
|
|
// user.ZipCode = '+966';
|
|
|
|
|
// user.Address = 'riyadh';
|
|
|
|
|
// user.FirstName = 'eye';
|
|
|
|
|
// user.MiddleName = 'user';
|
|
|
|
|
// user.LastName = 'measurment';
|
|
|
|
|
// user.Age = 30;
|
|
|
|
|
// user.agreed = true;
|
|
|
|
|
// const birthDate = new Date();
|
|
|
|
|
// birthDate.setFullYear(birthDate.getFullYear() - 29);
|
|
|
|
|
// user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate));
|
|
|
|
|
// user.Email = 'sultan.khan@hmg.local';
|
|
|
|
|
// user.PatientName = 'eye user';
|
|
|
|
|
// this.authService.updateLoggedInUser(user).subscribe(done => {
|
|
|
|
|
// this.authService.startIdleMonitoring();
|
|
|
|
|
// this.cs.openHome();
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
TODO login with mr rwaid
|
|
|
|
|
*/
|
|
|
|
|
public loginWithRwaid() {
|
|
|
|
|
alert('you are doing slient login width mr: rwaid account');
|
|
|
|
|
|
|
|
|
|
const user = new AuthenticatedUser();
|
|
|
|
|
// tamer with eye measurments 1231755
|
|
|
|
|
user.PatientID = 1018977;
|
|
|
|
|
user.PatientTypeID = PATIENT_TYPE.PERMANENT;
|
|
|
|
|
user.ProjectID = 0;
|
|
|
|
|
user.PatientOutSA = false;
|
|
|
|
|
user.TokenID = '@dm!n';
|
|
|
|
|
user.NationalityID = '1001242559';
|
|
|
|
|
user.MobileNo = user.MobileNumber = '545156035';
|
|
|
|
|
user.ZipCode = '+966';
|
|
|
|
|
user.Address = 'riyadh';
|
|
|
|
|
user.FirstName = 'rwaid';
|
|
|
|
|
user.MiddleName = 'el mallah';
|
|
|
|
|
user.LastName = 'mohammed';
|
|
|
|
|
user.Age = 30;
|
|
|
|
|
user.agreed = true;
|
|
|
|
|
const birthDate = new Date();
|
|
|
|
|
birthDate.setFullYear(birthDate.getFullYear() - 29);
|
|
|
|
|
user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate));
|
|
|
|
|
user.Email = 'mohamed.afifi@cloudsolution-sa.com';
|
|
|
|
|
user.PatientName = 'rwaid al mallah';
|
|
|
|
|
this.authService.updateLoggedInUser(user).subscribe(done => {
|
|
|
|
|
this.authService.startIdleMonitoring();
|
|
|
|
|
this.cs.openHome();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public loginWithTamer() {
|
|
|
|
|
alert('you are doing slient login width tamer account');
|
|
|
|
|
|
|
|
|
|
const user = new AuthenticatedUser();
|
|
|
|
|
user.PatientID = 1231755;
|
|
|
|
|
user.PatientTypeID = PATIENT_TYPE.PERMANENT;
|
|
|
|
|
user.ProjectID = 0;
|
|
|
|
|
user.PatientOutSA = false;
|
|
|
|
|
user.TokenID = '@dm!n';
|
|
|
|
|
user.NationalityID = '1001242559';
|
|
|
|
|
user.MobileNo = user.MobileNumber = '537503378';
|
|
|
|
|
user.ZipCode = '+966';
|
|
|
|
|
user.Address = 'riyadh';
|
|
|
|
|
user.FirstName = 'tamer';
|
|
|
|
|
user.MiddleName = 'faneshah';
|
|
|
|
|
user.LastName = 'faneshah';
|
|
|
|
|
user.Age = 30;
|
|
|
|
|
user.agreed = true;
|
|
|
|
|
const birthDate = new Date();
|
|
|
|
|
birthDate.setFullYear(birthDate.getFullYear() - 29);
|
|
|
|
|
user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate));
|
|
|
|
|
user.Email = 'mohamed.afifi@cloudsolution-sa.com';
|
|
|
|
|
user.PatientName = 'tamer fneshah';
|
|
|
|
|
this.authService.updateLoggedInUser(user).subscribe(done => {
|
|
|
|
|
this.authService.startIdleMonitoring();
|
|
|
|
|
this.cs.openHome();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// public loginWithRwaid() {
|
|
|
|
|
// alert('you are doing slient login width mr: rwaid account');
|
|
|
|
|
|
|
|
|
|
// const user = new AuthenticatedUser();
|
|
|
|
|
// // tamer with eye measurments 1231755
|
|
|
|
|
// user.PatientID = 1018977;
|
|
|
|
|
// user.PatientTypeID = PATIENT_TYPE.PERMANENT;
|
|
|
|
|
// user.ProjectID = 0;
|
|
|
|
|
// user.PatientOutSA = false;
|
|
|
|
|
// user.TokenID = '@dm!n';
|
|
|
|
|
// user.NationalityID = '1001242559';
|
|
|
|
|
// user.MobileNo = user.MobileNumber = '545156035';
|
|
|
|
|
// user.ZipCode = '+966';
|
|
|
|
|
// user.Address = 'riyadh';
|
|
|
|
|
// user.FirstName = 'rwaid';
|
|
|
|
|
// user.MiddleName = 'el mallah';
|
|
|
|
|
// user.LastName = 'mohammed';
|
|
|
|
|
// user.Age = 30;
|
|
|
|
|
// user.agreed = true;
|
|
|
|
|
// const birthDate = new Date();
|
|
|
|
|
// birthDate.setFullYear(birthDate.getFullYear() - 29);
|
|
|
|
|
// user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate));
|
|
|
|
|
// user.Email = 'mohamed.afifi@cloudsolution-sa.com';
|
|
|
|
|
// user.PatientName = 'rwaid al mallah';
|
|
|
|
|
// this.authService.updateLoggedInUser(user).subscribe(done => {
|
|
|
|
|
// this.authService.startIdleMonitoring();
|
|
|
|
|
// this.cs.openHome();
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// public loginWithTamer() {
|
|
|
|
|
// alert('you are doing slient login width tamer account');
|
|
|
|
|
|
|
|
|
|
// const user = new AuthenticatedUser();
|
|
|
|
|
// user.PatientID = 1231755;
|
|
|
|
|
// user.PatientTypeID = PATIENT_TYPE.PERMANENT;
|
|
|
|
|
// user.ProjectID = 0;
|
|
|
|
|
// user.PatientOutSA = false;
|
|
|
|
|
// user.TokenID = '@dm!n';
|
|
|
|
|
// user.NationalityID = '1001242559';
|
|
|
|
|
// user.MobileNo = user.MobileNumber = '537503378';
|
|
|
|
|
// user.ZipCode = '+966';
|
|
|
|
|
// user.Address = 'riyadh';
|
|
|
|
|
// user.FirstName = 'tamer';
|
|
|
|
|
// user.MiddleName = 'faneshah';
|
|
|
|
|
// user.LastName = 'faneshah';
|
|
|
|
|
// user.Age = 30;
|
|
|
|
|
// user.agreed = true;
|
|
|
|
|
// const birthDate = new Date();
|
|
|
|
|
// birthDate.setFullYear(birthDate.getFullYear() - 29);
|
|
|
|
|
// user.DateofBirth = this.cs.convertISODateToJsonDate(this.cs.getDateISO(birthDate));
|
|
|
|
|
// user.Email = 'mohamed.afifi@cloudsolution-sa.com';
|
|
|
|
|
// user.PatientName = 'tamer fneshah';
|
|
|
|
|
// this.authService.updateLoggedInUser(user).subscribe(done => {
|
|
|
|
|
// this.authService.startIdleMonitoring();
|
|
|
|
|
// this.cs.openHome();
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -352,27 +356,18 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
|
|
|
|
private checkUserAuthentication() {
|
|
|
|
|
const request = new CheckUserAuthenticationRequest();
|
|
|
|
|
request.PatientMobileNumber = this.mobileNumber;
|
|
|
|
|
request.ZipCode = this.zipCode;
|
|
|
|
|
request.isRegister = false;
|
|
|
|
|
request.TokenID = '';
|
|
|
|
|
|
|
|
|
|
request.P_USER_NAME = this.username;
|
|
|
|
|
request.P_LANGUAGE = this.language;
|
|
|
|
|
request.P_PASSWORD = this.password;
|
|
|
|
|
|
|
|
|
|
this.authService.checkUserAuthentication(
|
|
|
|
|
request,
|
|
|
|
|
() => {
|
|
|
|
|
|
|
|
|
|
}, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => {
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
this.loginTokenID = result.LogInTokenID;
|
|
|
|
|
this.patientOutSA = result.PatientOutSA;
|
|
|
|
|
this.isMobileFingerPrint = false;
|
|
|
|
|
this.FingerPrintPatientIdentificationID = '';
|
|
|
|
|
if (result.isSMSSent) {
|
|
|
|
|
this.startListeneingForSMS();
|
|
|
|
|
} else {
|
|
|
|
|
this.smsService.stopSMSMonitoring();
|
|
|
|
|
this.checkActivationCode();
|
|
|
|
|
}
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
this.loginData.LogInTokenID = result.LogInTokenID;
|
|
|
|
|
this.sharedData.setSharedData(this.loginData, "logindata");
|
|
|
|
|
this.cs.openSMSPage();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -402,7 +397,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private checkActivationCode(readedCode?) {
|
|
|
|
|
const request = new CheckActivationCodeRequest();
|
|
|
|
|
/*const request = new CheckActivationCodeRequest();
|
|
|
|
|
request.IsMobileFingerPrint = this.isMobileFingerPrint;
|
|
|
|
|
request.FingerPrintPatientIdentificationID = this.FingerPrintPatientIdentificationID;
|
|
|
|
|
request.LogInTokenID = this.loginTokenID;
|
|
|
|
|
@ -411,6 +406,8 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
request.IsSilentLogin = !readedCode;
|
|
|
|
|
request.PatientMobileNumber = this.mobileNumber;
|
|
|
|
|
request.ZipCode = this.zipCode;
|
|
|
|
|
request.isRegister = false;*/
|
|
|
|
|
|
|
|
|
|
// request.SearchType = this.loginType;
|
|
|
|
|
// if (this.loginType === LoginComponent.IDENTIFCIATION_LOGIN_TYPE) {
|
|
|
|
|
// request.PatientIdentificationID = this.id;
|
|
|
|
|
@ -419,7 +416,6 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
// request.PatientID = Number(this.id);
|
|
|
|
|
// request.PatientIdentificationID = '';
|
|
|
|
|
// }
|
|
|
|
|
request.isRegister = false;
|
|
|
|
|
// this.authService.checkActivationCode(
|
|
|
|
|
// request,
|
|
|
|
|
// () => {
|
|
|
|
|
@ -440,11 +436,11 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
private checkIfUserAgreedBefore(result: CheckActivationCodeResponse) {
|
|
|
|
|
|
|
|
|
|
this.authService.setAuthenticatedUser(result).subscribe(() => {
|
|
|
|
|
if (this.authService.isAgreedBefore()) {
|
|
|
|
|
this.cs.openHome();
|
|
|
|
|
} else {
|
|
|
|
|
// this.cs.openAgreement();
|
|
|
|
|
}
|
|
|
|
|
// if (this.authService.isAgreedBefore()) {
|
|
|
|
|
// this.cs.openHome();
|
|
|
|
|
// } else {
|
|
|
|
|
// // this.cs.openAgreement();
|
|
|
|
|
// }
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|