|
|
|
@ -1,66 +1,74 @@
|
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import { Injectable } from "@angular/core";
|
|
|
|
import { Request } from '../models/request';
|
|
|
|
import { Request } from "../models/request";
|
|
|
|
import { TranslatorService } from '../translator/translator.service';
|
|
|
|
import { TranslatorService } from "../translator/translator.service";
|
|
|
|
import { ConnectorService } from '../connector/connector.service';
|
|
|
|
import { ConnectorService } from "../connector/connector.service";
|
|
|
|
import { Observable, throwError } from 'rxjs';
|
|
|
|
import { Observable, throwError } from "rxjs";
|
|
|
|
import { CheckPatientRegisterationRequest } from './models/check-patient-registeration.request';
|
|
|
|
import { CheckPatientRegisterationRequest } from "./models/check-patient-registeration.request";
|
|
|
|
import { LoginRequest } from './models/login.request';
|
|
|
|
import { LoginRequest } from "./models/login.request";
|
|
|
|
import { Response } from '../models/response';
|
|
|
|
import { Response } from "../models/response";
|
|
|
|
import { AuthenticatedUser } from './models/authenticated-user';
|
|
|
|
import { AuthenticatedUser } from "./models/authenticated-user";
|
|
|
|
import { CommonService } from '../common/common.service';
|
|
|
|
import { CommonService } from "../common/common.service";
|
|
|
|
import { CheckUserAuthenticationRequest } from './models/check-user-auth.request';
|
|
|
|
import { CheckUserAuthenticationRequest } from "./models/check-user-auth.request";
|
|
|
|
import { CheckActivationCodeRequest } from './models/check-activation-code.request';
|
|
|
|
import { CheckActivationCodeRequest } from "./models/check-activation-code.request";
|
|
|
|
import { CheckUserAuthenticationResponse } from './models/check-user-auth.response';
|
|
|
|
import { CheckUserAuthenticationResponse } from "./models/check-user-auth.response";
|
|
|
|
import { CheckActivationCodeResponse } from './models/check-activation-code.response';
|
|
|
|
import { CheckActivationCodeResponse } from "./models/check-activation-code.response";
|
|
|
|
import { NativeStorage } from '@ionic-native/native-storage/ngx';
|
|
|
|
import { NativeStorage } from "@ionic-native/native-storage/ngx";
|
|
|
|
import { CheckRegisterationCodeRequest } from './models/check-registeration-code.request';
|
|
|
|
import { CheckRegisterationCodeRequest } from "./models/check-registeration-code.request";
|
|
|
|
import { RegisterInformationRequest } from './models/register-information.request';
|
|
|
|
import { RegisterInformationRequest } from "./models/register-information.request";
|
|
|
|
import { ForgotFileIDResponse } from './models/forgot-File-ID.response';
|
|
|
|
import { ForgotFileIDResponse } from "./models/forgot-File-ID.response";
|
|
|
|
import { EmailRequest } from '../models/email-request';
|
|
|
|
import { EmailRequest } from "../models/email-request";
|
|
|
|
import { EmailInput } from '../../ui/email/models/email-input';
|
|
|
|
import { EmailInput } from "../../ui/email/models/email-input";
|
|
|
|
import { UserLocalNotificationService } from '../user-local-notification/user-local-notification.service';
|
|
|
|
import { UserLocalNotificationService } from "../user-local-notification/user-local-notification.service";
|
|
|
|
import { GetLoginInfoRequest } from './models/get-login-info.request';
|
|
|
|
import { GetLoginInfoRequest } from "./models/get-login-info.request";
|
|
|
|
import { GetLoginInfoResponse } from './models/get-login-info.response';
|
|
|
|
import { GetLoginInfoResponse } from "./models/get-login-info.response";
|
|
|
|
import { analyzeAndValidateNgModules } from '@angular/compiler';
|
|
|
|
import { analyzeAndValidateNgModules } from "@angular/compiler";
|
|
|
|
import { Events } from '@ionic/angular';
|
|
|
|
import { Events } from "@ionic/angular";
|
|
|
|
import { InternationalMobileComponent } from '../../ui/mobile-number/international-mobile/international-mobile.component';
|
|
|
|
import { InternationalMobileComponent } from "../../ui/mobile-number/international-mobile/international-mobile.component";
|
|
|
|
import { SMSCheckRequest } from './models/smscheck.request';
|
|
|
|
import { SMSCheckRequest } from "./models/smscheck.request";
|
|
|
|
import { SMSCheckResponse } from './models/smscheck.response';
|
|
|
|
import { SMSCheckResponse } from "./models/smscheck.response";
|
|
|
|
|
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
@Injectable({
|
|
|
|
providedIn: 'root'
|
|
|
|
providedIn: "root"
|
|
|
|
})
|
|
|
|
})
|
|
|
|
export class AuthenticationService {
|
|
|
|
export class AuthenticationService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static MOBILE_USER = 102;
|
|
|
|
public static MOBILE_USER = 102;
|
|
|
|
|
|
|
|
|
|
|
|
/* login methods */
|
|
|
|
/* login methods */
|
|
|
|
public static loginURL = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
|
|
|
|
public static loginURL =
|
|
|
|
public static checkUserAuthURL = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
|
|
|
|
"Services/Authentication.svc/REST/CheckPatientAuthentication";
|
|
|
|
|
|
|
|
public static checkUserAuthURL =
|
|
|
|
|
|
|
|
"Services/Authentication.svc/REST/CheckPatientAuthentication";
|
|
|
|
|
|
|
|
|
|
|
|
public static login = 'Services/ERP.svc/REST/MemberLogin';
|
|
|
|
public static login = "Services/ERP.svc/REST/MemberLogin";
|
|
|
|
|
|
|
|
|
|
|
|
public static activationCodeURL = 'Services/Authentication.svc/REST/CheckActivationCode';
|
|
|
|
public static activationCodeURL =
|
|
|
|
public static getLoginInfoURL = 'Services/Authentication.svc/REST/GetMobileLoginInfo';
|
|
|
|
"Services/Authentication.svc/REST/CheckActivationCode";
|
|
|
|
|
|
|
|
public static getLoginInfoURL =
|
|
|
|
|
|
|
|
"Services/Authentication.svc/REST/GetMobileLoginInfo";
|
|
|
|
|
|
|
|
|
|
|
|
public static smsCheck='Services/ERP.svc/REST/CheckActivationCode';
|
|
|
|
public static smsCheck = "Services/ERP.svc/REST/CheckActivationCode";
|
|
|
|
public static smsCheckForget='Services/ERP.svc/REST/CheckPublicActivationCode';
|
|
|
|
public static smsCheckForget =
|
|
|
|
public static smsSendCode='Services/ERP.svc/REST/SendPublicActivationCode';
|
|
|
|
"Services/ERP.svc/REST/CheckPublicActivationCode";
|
|
|
|
|
|
|
|
public static smsSendCode = "Services/ERP.svc/REST/SendPublicActivationCode";
|
|
|
|
|
|
|
|
|
|
|
|
/* register methods */
|
|
|
|
/* register methods */
|
|
|
|
|
|
|
|
|
|
|
|
public static checkPatientForRegisterationURL = 'Services/Authentication.svc/REST/CheckPatientForRegisteration';
|
|
|
|
public static checkPatientForRegisterationURL =
|
|
|
|
public static sendSmsForRegisterURL = 'Services/Authentication.svc/REST/SendSMSForPatientRegisteration';
|
|
|
|
"Services/Authentication.svc/REST/CheckPatientForRegisteration";
|
|
|
|
public static registerTempUserURL = 'Services/Authentication.svc/REST/RegisterTempPatientWithoutSMS';
|
|
|
|
public static sendSmsForRegisterURL =
|
|
|
|
|
|
|
|
"Services/Authentication.svc/REST/SendSMSForPatientRegisteration";
|
|
|
|
public static sendSMSForgotFileNoURL = 'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber';
|
|
|
|
public static registerTempUserURL =
|
|
|
|
public static forgotFileIDURL = 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo';
|
|
|
|
"Services/Authentication.svc/REST/RegisterTempPatientWithoutSMS";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static sendSMSForgotFileNoURL =
|
|
|
|
|
|
|
|
"Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber";
|
|
|
|
|
|
|
|
public static forgotFileIDURL =
|
|
|
|
|
|
|
|
"Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo";
|
|
|
|
public static user: AuthenticatedUser;
|
|
|
|
public static user: AuthenticatedUser;
|
|
|
|
|
|
|
|
|
|
|
|
public static LOGIN_EVENT = 'user-login-event';
|
|
|
|
public static LOGIN_EVENT = "user-login-event";
|
|
|
|
public static FAMILY_LOGIN_EVENT = 'family-login-event';
|
|
|
|
public static FAMILY_LOGIN_EVENT = "family-login-event";
|
|
|
|
public static AUTHENTICATED_USER_KEY = 'save-authenticated-user';
|
|
|
|
public static AUTHENTICATED_USER_KEY = "save-authenticated-user";
|
|
|
|
|
|
|
|
|
|
|
|
// private static user: AuthenticatedUser;
|
|
|
|
// private static user: AuthenticatedUser;
|
|
|
|
constructor(
|
|
|
|
constructor(
|
|
|
|
@ -70,18 +78,19 @@ export class AuthenticationService {
|
|
|
|
public nativeStorage: NativeStorage,
|
|
|
|
public nativeStorage: NativeStorage,
|
|
|
|
public localNotifications: UserLocalNotificationService,
|
|
|
|
public localNotifications: UserLocalNotificationService,
|
|
|
|
private events: Events
|
|
|
|
private events: Events
|
|
|
|
) { }
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
|
|
public authenticateRequest(request: Request, automaticLogin = true): Request {
|
|
|
|
public authenticateRequest(request: Request, automaticLogin = true): Request {
|
|
|
|
|
|
|
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
this.setPublicFields(request);
|
|
|
|
const user = this.getAuthenticatedUser();
|
|
|
|
const user = this.getAuthenticatedUser();
|
|
|
|
if (user) {
|
|
|
|
if (user) {
|
|
|
|
/*user with eye prescriptions*/
|
|
|
|
/*user with eye prescriptions*/
|
|
|
|
// request.PatientID = user.PatientID;
|
|
|
|
request.P_SESSION_ID = user.P_SESSION_ID;
|
|
|
|
// request.TokenID = user.TokenID;
|
|
|
|
request.MobileNumber = user.EMPLOYEE_MOBILE_NUMBER;
|
|
|
|
// request.PatientOutSA = user.PatientOutSA ? 1 : 0;
|
|
|
|
request.LogInTokenID = user.LogInTokenID;
|
|
|
|
// request.PatientTypeID = user.PatientTypeID;
|
|
|
|
request.TokenID = user.TokenID;
|
|
|
|
|
|
|
|
request.P_USER_NAME = user.EMPLOYEE_NUMBER;
|
|
|
|
|
|
|
|
request.UserName = user.EMPLOYEE_NUMBER;
|
|
|
|
if (AuthenticationService.requireRelogin) {
|
|
|
|
if (AuthenticationService.requireRelogin) {
|
|
|
|
this.sessionTimeOutDialog();
|
|
|
|
this.sessionTimeOutDialog();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -103,13 +112,16 @@ export class AuthenticationService {
|
|
|
|
request.Channel = 31;
|
|
|
|
request.Channel = 31;
|
|
|
|
request.LanguageID = TranslatorService.getCurrentLanguageCode();
|
|
|
|
request.LanguageID = TranslatorService.getCurrentLanguageCode();
|
|
|
|
//request.IPAdress = '10.10.10.10';
|
|
|
|
//request.IPAdress = '10.10.10.10';
|
|
|
|
request.SessionID = 'any thing'; // ??? required for not authorized login funny
|
|
|
|
//request.SessionID = "any thing"; // ??? required for not authorized login funny
|
|
|
|
request.MobileType = "android";
|
|
|
|
request.MobileType = "android";
|
|
|
|
//request.isDentalAllowedBackend = false;
|
|
|
|
//request.isDentalAllowedBackend = false;
|
|
|
|
return request;
|
|
|
|
return request;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public authenticateAndSetPersonalInformation(request: EmailRequest, examinationInfo?: any): EmailRequest {
|
|
|
|
public authenticateAndSetPersonalInformation(
|
|
|
|
|
|
|
|
request: EmailRequest,
|
|
|
|
|
|
|
|
examinationInfo?: any
|
|
|
|
|
|
|
|
): EmailRequest {
|
|
|
|
// if not authenticated will be redirected to login
|
|
|
|
// if not authenticated will be redirected to login
|
|
|
|
this.authenticateRequest(request);
|
|
|
|
this.authenticateRequest(request);
|
|
|
|
const user = this.getAuthenticatedUser();
|
|
|
|
const user = this.getAuthenticatedUser();
|
|
|
|
@ -123,53 +135,67 @@ export class AuthenticationService {
|
|
|
|
// request.PatientTypeID = user.PatientTypeID;
|
|
|
|
// request.PatientTypeID = user.PatientTypeID;
|
|
|
|
|
|
|
|
|
|
|
|
if (examinationInfo) {
|
|
|
|
if (examinationInfo) {
|
|
|
|
if (examinationInfo.SetupID) { request.SetupID = examinationInfo.SetupID; }
|
|
|
|
if (examinationInfo.SetupID) {
|
|
|
|
if (examinationInfo.ProjectName) { request.ProjectName = examinationInfo.ProjectName; }
|
|
|
|
request.SetupID = examinationInfo.SetupID;
|
|
|
|
if (examinationInfo.ClinicName) { request.ClinicName = examinationInfo.ClinicDescription; }
|
|
|
|
}
|
|
|
|
if (examinationInfo.DoctorName) { request.DoctorName = examinationInfo.DoctorName; }
|
|
|
|
if (examinationInfo.ProjectName) {
|
|
|
|
if (examinationInfo.ProjectID) { request.ProjectID = examinationInfo.ProjectID; }
|
|
|
|
request.ProjectName = examinationInfo.ProjectName;
|
|
|
|
if (examinationInfo.InvoiceNo) { request.InvoiceNo = examinationInfo.InvoiceNo; }
|
|
|
|
}
|
|
|
|
|
|
|
|
if (examinationInfo.ClinicName) {
|
|
|
|
|
|
|
|
request.ClinicName = examinationInfo.ClinicDescription;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (examinationInfo.DoctorName) {
|
|
|
|
|
|
|
|
request.DoctorName = examinationInfo.DoctorName;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (examinationInfo.ProjectID) {
|
|
|
|
|
|
|
|
request.ProjectID = examinationInfo.ProjectID;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (examinationInfo.InvoiceNo) {
|
|
|
|
|
|
|
|
request.InvoiceNo = examinationInfo.InvoiceNo;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (examinationInfo.OrderDate) {
|
|
|
|
if (examinationInfo.OrderDate) {
|
|
|
|
request.OrderDate = this.cs.getDateISO(this.cs.evaluteDateAsObject(examinationInfo.OrderDate));
|
|
|
|
request.OrderDate = this.cs.getDateISO(
|
|
|
|
|
|
|
|
this.cs.evaluteDateAsObject(examinationInfo.OrderDate)
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return request;
|
|
|
|
return request;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public getAuthenticatedRequest(login = true): Request {
|
|
|
|
public getAuthenticatedRequest(login = true): Request {
|
|
|
|
const request = new Request();
|
|
|
|
const request = new Request();
|
|
|
|
this.authenticateRequest(request, login);
|
|
|
|
this.authenticateRequest(request, login);
|
|
|
|
return request;
|
|
|
|
return request;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public getPublicRequest(): Request {
|
|
|
|
public getPublicRequest(): Request {
|
|
|
|
const request = new Request();
|
|
|
|
const request = new Request();
|
|
|
|
this.setPublicFields(request);
|
|
|
|
this.setPublicFields(request);
|
|
|
|
return request;
|
|
|
|
return request;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public login(
|
|
|
|
public login(request: LoginRequest, onError: any, errorLabel: string): Observable<Response> {
|
|
|
|
request: LoginRequest,
|
|
|
|
|
|
|
|
onError: any,
|
|
|
|
|
|
|
|
errorLabel: string
|
|
|
|
|
|
|
|
): Observable<Response> {
|
|
|
|
request.PatientID = 0;
|
|
|
|
request.PatientID = 0;
|
|
|
|
request.TokenID = '';
|
|
|
|
request.TokenID = "";
|
|
|
|
request.isDentalAllowedBackend = false;
|
|
|
|
request.isDentalAllowedBackend = false;
|
|
|
|
request.isRegister = false;
|
|
|
|
request.isRegister = false;
|
|
|
|
return this.con.post(AuthenticationService.loginURL, request, onError, errorLabel);
|
|
|
|
return this.con.post(
|
|
|
|
|
|
|
|
AuthenticationService.loginURL,
|
|
|
|
|
|
|
|
request,
|
|
|
|
|
|
|
|
onError,
|
|
|
|
|
|
|
|
errorLabel
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public isAuthenticated(): boolean {
|
|
|
|
public isAuthenticated(): boolean {
|
|
|
|
return AuthenticationService.user != null;
|
|
|
|
return AuthenticationService.user != null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* this fucntion load from user information if he logged in before
|
|
|
|
* this fucntion load from user information if he logged in before
|
|
|
|
* and save user into memory and local storage
|
|
|
|
* and save user into memory and local storage
|
|
|
|
@ -180,49 +206,47 @@ export class AuthenticationService {
|
|
|
|
* 1- user stored in local storage without token
|
|
|
|
* 1- user stored in local storage without token
|
|
|
|
* @param result check activation code result
|
|
|
|
* @param result check activation code result
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public setAuthenticatedUser(result: CheckActivationCodeResponse): Observable<boolean> {
|
|
|
|
public setAuthenticatedUser(
|
|
|
|
|
|
|
|
result: CheckActivationCodeResponse
|
|
|
|
|
|
|
|
): Observable<boolean> {
|
|
|
|
return Observable.create(observer => {
|
|
|
|
return Observable.create(observer => {
|
|
|
|
this.loadAuthenticatedUser().subscribe((loadedUser: AuthenticatedUser) => {
|
|
|
|
this.loadAuthenticatedUser().subscribe(
|
|
|
|
|
|
|
|
(loadedUser: AuthenticatedUser) => {
|
|
|
|
AuthenticationService.requireRelogin = false;
|
|
|
|
AuthenticationService.requireRelogin = false;
|
|
|
|
this.startIdleMonitoring();
|
|
|
|
this.startIdleMonitoring();
|
|
|
|
const user = this.updateAuthenticatedUser(result, loadedUser);
|
|
|
|
const user = this.updateAuthenticatedUser(result, loadedUser);
|
|
|
|
/* we store in hd without token but with token in memory*/
|
|
|
|
/* we store in hd without token but with token in memory*/
|
|
|
|
this.saveUserInStorage(user).subscribe((success: boolean) => {
|
|
|
|
this.saveUserInStorage(user).subscribe((success: boolean) => {
|
|
|
|
AuthenticationService.user = user;
|
|
|
|
AuthenticationService.user = user;
|
|
|
|
|
|
|
|
|
|
|
|
this.publishUserChangeEvent();
|
|
|
|
this.publishUserChangeEvent();
|
|
|
|
observer.next(true);
|
|
|
|
observer.next(true);
|
|
|
|
observer.complete();
|
|
|
|
observer.complete();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public resetAuthenticatedUser(user: AuthenticatedUser ) {
|
|
|
|
public resetAuthenticatedUser(user: AuthenticatedUser) {
|
|
|
|
AuthenticationService.user = user;
|
|
|
|
AuthenticationService.user = user;
|
|
|
|
AuthenticationService.requireRelogin = false;
|
|
|
|
AuthenticationService.requireRelogin = false;
|
|
|
|
this.startIdleMonitoring();
|
|
|
|
this.startIdleMonitoring();
|
|
|
|
this.publishUserChangeEvent();
|
|
|
|
this.publishUserChangeEvent();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public setAuthenticatedMemberFamilyUser(result: CheckActivationCodeResponse) {
|
|
|
|
public setAuthenticatedMemberFamilyUser(result: CheckActivationCodeResponse) {
|
|
|
|
|
|
|
|
|
|
|
|
const authUser = new AuthenticatedUser();
|
|
|
|
const authUser = new AuthenticatedUser();
|
|
|
|
AuthenticationService.requireRelogin = false;
|
|
|
|
AuthenticationService.requireRelogin = false;
|
|
|
|
this.startIdleMonitoring();
|
|
|
|
this.startIdleMonitoring();
|
|
|
|
const user = this.updateAuthenticatedUser(result, authUser);
|
|
|
|
const user = this.updateAuthenticatedUser(result, authUser);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// user["hello"]= "ok";
|
|
|
|
// user["hello"]= "ok";
|
|
|
|
/* we store in hd without token but with token in memory*/
|
|
|
|
/* we store in hd without token but with token in memory*/
|
|
|
|
AuthenticationService.user = user;
|
|
|
|
AuthenticationService.user = user;
|
|
|
|
this.publishFamilyMemeberUserChangeEvent();
|
|
|
|
this.publishFamilyMemeberUserChangeEvent();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public updateLoggedInUser(newUser: AuthenticatedUser): Observable<boolean> {
|
|
|
|
public updateLoggedInUser(newUser: AuthenticatedUser): Observable<boolean> {
|
|
|
|
return Observable.create(observer => {
|
|
|
|
return Observable.create(observer => {
|
|
|
|
/* we store in hd without token but with token in memory*/
|
|
|
|
/* we store in hd without token but with token in memory*/
|
|
|
|
@ -233,9 +257,7 @@ export class AuthenticationService {
|
|
|
|
observer.next(success);
|
|
|
|
observer.next(success);
|
|
|
|
observer.complete();
|
|
|
|
observer.complete();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public setDeviceToken(token: string) {
|
|
|
|
public setDeviceToken(token: string) {
|
|
|
|
@ -248,26 +270,49 @@ export class AuthenticationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public registerTempUser(request: RegisterInformationRequest, onError: any, errorLabel: string)
|
|
|
|
public registerTempUser(
|
|
|
|
: Observable<CheckActivationCodeResponse> {
|
|
|
|
request: RegisterInformationRequest,
|
|
|
|
|
|
|
|
onError: any,
|
|
|
|
|
|
|
|
errorLabel: string
|
|
|
|
|
|
|
|
): Observable<CheckActivationCodeResponse> {
|
|
|
|
this.setPublicFields(request);
|
|
|
|
this.setPublicFields(request);
|
|
|
|
request.TokenID = '';
|
|
|
|
request.TokenID = "";
|
|
|
|
return this.con.post(AuthenticationService.registerTempUserURL, request, onError, errorLabel);
|
|
|
|
return this.con.post(
|
|
|
|
|
|
|
|
AuthenticationService.registerTempUserURL,
|
|
|
|
|
|
|
|
request,
|
|
|
|
|
|
|
|
onError,
|
|
|
|
|
|
|
|
errorLabel
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public getLoginInfo(request: GetLoginInfoRequest, onError: any, errorLabel: string)
|
|
|
|
public getLoginInfo(
|
|
|
|
: Observable<GetLoginInfoResponse> {
|
|
|
|
request: GetLoginInfoRequest,
|
|
|
|
|
|
|
|
onError: any,
|
|
|
|
|
|
|
|
errorLabel: string
|
|
|
|
|
|
|
|
): Observable<GetLoginInfoResponse> {
|
|
|
|
this.setPublicFields(request);
|
|
|
|
this.setPublicFields(request);
|
|
|
|
return this.con.post(AuthenticationService.getLoginInfoURL, request, onError, errorLabel);
|
|
|
|
return this.con.post(
|
|
|
|
|
|
|
|
AuthenticationService.getLoginInfoURL,
|
|
|
|
|
|
|
|
request,
|
|
|
|
|
|
|
|
onError,
|
|
|
|
|
|
|
|
errorLabel
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*update new authenticated user from previously stored and loaded user
|
|
|
|
*update new authenticated user from previously stored and loaded user
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private updateAuthenticatedUser(result: CheckActivationCodeResponse, loadedUser: AuthenticatedUser): AuthenticatedUser {
|
|
|
|
private updateAuthenticatedUser(
|
|
|
|
|
|
|
|
result: CheckActivationCodeResponse,
|
|
|
|
|
|
|
|
loadedUser: AuthenticatedUser
|
|
|
|
|
|
|
|
): AuthenticatedUser {
|
|
|
|
const user = result.MemberInformationList[0];
|
|
|
|
const user = result.MemberInformationList[0];
|
|
|
|
|
|
|
|
user.P_SESSION_ID = result.P_SESSION_ID;
|
|
|
|
|
|
|
|
user.MobileNumber = result.EMPLOYEE_MOBILE_NUMBER;
|
|
|
|
|
|
|
|
user.TokenID = result.TokenID;
|
|
|
|
|
|
|
|
user.LogInTokenID = this.cs.sharedService.getSharedData(
|
|
|
|
|
|
|
|
"logindata"
|
|
|
|
|
|
|
|
).LogInTokenID;
|
|
|
|
return user;
|
|
|
|
return user;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -284,12 +329,12 @@ export class AuthenticationService {
|
|
|
|
* we store in localstorage without token but we keep it in the static member
|
|
|
|
* we store in localstorage without token but we keep it in the static member
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private saveUserInStorage(user: AuthenticatedUser): Observable<boolean> {
|
|
|
|
private saveUserInStorage(user: AuthenticatedUser): Observable<boolean> {
|
|
|
|
|
|
|
|
|
|
|
|
return Observable.create(observer => {
|
|
|
|
return Observable.create(observer => {
|
|
|
|
if (user) {
|
|
|
|
if (user) {
|
|
|
|
// const TokenID = user.TokenID;
|
|
|
|
// const TokenID = user.TokenID;
|
|
|
|
// user.TokenID = null;
|
|
|
|
// user.TokenID = null;
|
|
|
|
this.nativeStorage.setItem(AuthenticationService.AUTHENTICATED_USER_KEY, user)
|
|
|
|
this.nativeStorage
|
|
|
|
|
|
|
|
.setItem(AuthenticationService.AUTHENTICATED_USER_KEY, user)
|
|
|
|
.then(
|
|
|
|
.then(
|
|
|
|
() => {
|
|
|
|
() => {
|
|
|
|
//user.TokenID = TokenID;
|
|
|
|
//user.TokenID = TokenID;
|
|
|
|
@ -307,9 +352,7 @@ export class AuthenticationService {
|
|
|
|
observer.next(false);
|
|
|
|
observer.next(false);
|
|
|
|
observer.complete();
|
|
|
|
observer.complete();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -320,7 +363,9 @@ export class AuthenticationService {
|
|
|
|
this.clearUserSession();
|
|
|
|
this.clearUserSession();
|
|
|
|
return Observable.create(observer => {
|
|
|
|
return Observable.create(observer => {
|
|
|
|
this.publishUserChangeEvent();
|
|
|
|
this.publishUserChangeEvent();
|
|
|
|
this.nativeStorage.remove(AuthenticationService.AUTHENTICATED_USER_KEY).then(
|
|
|
|
this.nativeStorage
|
|
|
|
|
|
|
|
.remove(AuthenticationService.AUTHENTICATED_USER_KEY)
|
|
|
|
|
|
|
|
.then(
|
|
|
|
() => {
|
|
|
|
() => {
|
|
|
|
observer.next(true);
|
|
|
|
observer.next(true);
|
|
|
|
observer.complete();
|
|
|
|
observer.complete();
|
|
|
|
@ -328,16 +373,25 @@ export class AuthenticationService {
|
|
|
|
() => {
|
|
|
|
() => {
|
|
|
|
observer.next(false);
|
|
|
|
observer.next(false);
|
|
|
|
observer.complete();
|
|
|
|
observer.complete();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private publishUserChangeEvent() {
|
|
|
|
private publishUserChangeEvent() {
|
|
|
|
this.events.publish(AuthenticationService.LOGIN_EVENT, this.getAuthenticatedUser(), Date.now());
|
|
|
|
this.events.publish(
|
|
|
|
|
|
|
|
AuthenticationService.LOGIN_EVENT,
|
|
|
|
|
|
|
|
this.getAuthenticatedUser(),
|
|
|
|
|
|
|
|
Date.now()
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private publishFamilyMemeberUserChangeEvent() {
|
|
|
|
private publishFamilyMemeberUserChangeEvent() {
|
|
|
|
this.events.publish(AuthenticationService.FAMILY_LOGIN_EVENT, this.getAuthenticatedUser(), Date.now());
|
|
|
|
this.events.publish(
|
|
|
|
|
|
|
|
AuthenticationService.FAMILY_LOGIN_EVENT,
|
|
|
|
|
|
|
|
this.getAuthenticatedUser(),
|
|
|
|
|
|
|
|
Date.now()
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public clearUserSession() {
|
|
|
|
public clearUserSession() {
|
|
|
|
@ -346,10 +400,10 @@ export class AuthenticationService {
|
|
|
|
|
|
|
|
|
|
|
|
public loadAuthenticatedUser(): Observable<AuthenticatedUser> {
|
|
|
|
public loadAuthenticatedUser(): Observable<AuthenticatedUser> {
|
|
|
|
return Observable.create(observer => {
|
|
|
|
return Observable.create(observer => {
|
|
|
|
|
|
|
|
this.nativeStorage
|
|
|
|
this.nativeStorage.getItem(AuthenticationService.AUTHENTICATED_USER_KEY)
|
|
|
|
.getItem(AuthenticationService.AUTHENTICATED_USER_KEY)
|
|
|
|
.then(
|
|
|
|
.then(
|
|
|
|
(user) => {
|
|
|
|
user => {
|
|
|
|
observer.next(user);
|
|
|
|
observer.next(user);
|
|
|
|
observer.complete();
|
|
|
|
observer.complete();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
@ -376,80 +430,125 @@ export class AuthenticationService {
|
|
|
|
return AuthenticationService.user;
|
|
|
|
return AuthenticationService.user;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public checkUserAuthentication(
|
|
|
|
public checkUserAuthentication(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string)
|
|
|
|
request: CheckUserAuthenticationRequest,
|
|
|
|
: Observable<CheckUserAuthenticationResponse> {
|
|
|
|
onError: any,
|
|
|
|
|
|
|
|
errorLabel: string
|
|
|
|
|
|
|
|
): Observable<CheckUserAuthenticationResponse> {
|
|
|
|
this.setPublicFields(request);
|
|
|
|
this.setPublicFields(request);
|
|
|
|
return this.con.post(AuthenticationService.login, request, onError, errorLabel);
|
|
|
|
return this.con.post(
|
|
|
|
|
|
|
|
AuthenticationService.login,
|
|
|
|
|
|
|
|
request,
|
|
|
|
|
|
|
|
onError,
|
|
|
|
|
|
|
|
errorLabel
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public checkActivationCode(request: CheckActivationCodeRequest, onError: any, errorLabel: string)
|
|
|
|
public checkActivationCode(
|
|
|
|
: Observable<CheckActivationCodeResponse> {
|
|
|
|
request: CheckActivationCodeRequest,
|
|
|
|
|
|
|
|
onError: any,
|
|
|
|
|
|
|
|
errorLabel: string
|
|
|
|
|
|
|
|
): Observable<CheckActivationCodeResponse> {
|
|
|
|
this.setPublicFields(request);
|
|
|
|
this.setPublicFields(request);
|
|
|
|
return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel);
|
|
|
|
return this.con.post(
|
|
|
|
|
|
|
|
AuthenticationService.activationCodeURL,
|
|
|
|
|
|
|
|
request,
|
|
|
|
|
|
|
|
onError,
|
|
|
|
|
|
|
|
errorLabel
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public checkSMS(request: SMSCheckRequest, onError: any, errorLabel: string)
|
|
|
|
public checkSMS(
|
|
|
|
: Observable<SMSCheckResponse> {
|
|
|
|
request: SMSCheckRequest,
|
|
|
|
this.setPublicFields(request);
|
|
|
|
onError: any,
|
|
|
|
return this.con.post(AuthenticationService.smsCheck, request, onError, errorLabel);
|
|
|
|
errorLabel: string
|
|
|
|
|
|
|
|
): Observable<SMSCheckResponse> {
|
|
|
|
|
|
|
|
//this.setPublicFields(request);
|
|
|
|
|
|
|
|
return this.con.post(
|
|
|
|
|
|
|
|
AuthenticationService.smsCheck,
|
|
|
|
|
|
|
|
request,
|
|
|
|
|
|
|
|
onError,
|
|
|
|
|
|
|
|
errorLabel
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
client side:
|
|
|
|
client side:
|
|
|
|
id no , mobile no , zip code
|
|
|
|
id no , mobile no , zip code
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public checkPatientForRegisteration(request: CheckPatientRegisterationRequest, onError: any, errorLabel: string)
|
|
|
|
|
|
|
|
: Observable<Response> {
|
|
|
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
|
|
|
request.TokenID = '';
|
|
|
|
|
|
|
|
request.PatientID = 0;
|
|
|
|
|
|
|
|
request.isRegister = false;
|
|
|
|
|
|
|
|
return this.con.post(AuthenticationService.checkPatientForRegisterationURL, request, onError, errorLabel);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
client side:
|
|
|
|
client side:
|
|
|
|
id no , mobile no , zip code
|
|
|
|
id no , mobile no , zip code
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public sendSmsForPatientRegisteration(request: CheckPatientRegisterationRequest, onError: any, errorLabel: string)
|
|
|
|
public sendSmsForPatientRegisteration(
|
|
|
|
: Observable<CheckUserAuthenticationResponse> {
|
|
|
|
request: CheckPatientRegisterationRequest,
|
|
|
|
|
|
|
|
onError: any,
|
|
|
|
|
|
|
|
errorLabel: string
|
|
|
|
|
|
|
|
): Observable<CheckUserAuthenticationResponse> {
|
|
|
|
this.setPublicFields(request);
|
|
|
|
this.setPublicFields(request);
|
|
|
|
request.TokenID = '';
|
|
|
|
request.TokenID = "";
|
|
|
|
request.PatientID = 0;
|
|
|
|
|
|
|
|
request.isRegister = false;
|
|
|
|
request.isRegister = false;
|
|
|
|
return this.con.post(AuthenticationService.sendSmsForRegisterURL, request, onError, errorLabel);
|
|
|
|
return this.con.post(
|
|
|
|
|
|
|
|
AuthenticationService.sendSmsForRegisterURL,
|
|
|
|
|
|
|
|
request,
|
|
|
|
|
|
|
|
onError,
|
|
|
|
|
|
|
|
errorLabel
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public checkRegisterationActivationCode(request: CheckRegisterationCodeRequest, onError: any, errorLabel: string)
|
|
|
|
public checkRegisterationActivationCode(
|
|
|
|
: Observable<Response> {
|
|
|
|
request: CheckRegisterationCodeRequest,
|
|
|
|
|
|
|
|
onError: any,
|
|
|
|
|
|
|
|
errorLabel: string
|
|
|
|
|
|
|
|
): Observable<Response> {
|
|
|
|
this.setPublicFields(request);
|
|
|
|
this.setPublicFields(request);
|
|
|
|
return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel);
|
|
|
|
return this.con.post(
|
|
|
|
|
|
|
|
AuthenticationService.activationCodeURL,
|
|
|
|
|
|
|
|
request,
|
|
|
|
|
|
|
|
onError,
|
|
|
|
|
|
|
|
errorLabel
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public sendSMSForForgotFileNumber(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string)
|
|
|
|
public sendSMSForForgotFileNumber(
|
|
|
|
: Observable<CheckUserAuthenticationResponse> {
|
|
|
|
request: CheckUserAuthenticationRequest,
|
|
|
|
|
|
|
|
onError: any,
|
|
|
|
|
|
|
|
errorLabel: string
|
|
|
|
|
|
|
|
): Observable<CheckUserAuthenticationResponse> {
|
|
|
|
this.setPublicFields(request);
|
|
|
|
this.setPublicFields(request);
|
|
|
|
request.TokenID = '';
|
|
|
|
request.TokenID = "";
|
|
|
|
request.PatientIdentificationID = '';
|
|
|
|
// request.PatientIdentificationID = '';
|
|
|
|
request.PatientID = 0;
|
|
|
|
// request.PatientID = 0;
|
|
|
|
//request.SearchType = 2;
|
|
|
|
//request.SearchType = 2;
|
|
|
|
//request.isRegister = false;
|
|
|
|
//request.isRegister = false;
|
|
|
|
return this.con.post(AuthenticationService.sendSMSForgotFileNoURL, request, onError, errorLabel);
|
|
|
|
return this.con.post(
|
|
|
|
|
|
|
|
AuthenticationService.sendSMSForgotFileNoURL,
|
|
|
|
|
|
|
|
request,
|
|
|
|
|
|
|
|
onError,
|
|
|
|
|
|
|
|
errorLabel
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public forgotFileIdActivation(request: CheckActivationCodeRequest, onError: any, errorLabel: string)
|
|
|
|
public forgotFileIdActivation(
|
|
|
|
: Observable<ForgotFileIDResponse> {
|
|
|
|
request: CheckActivationCodeRequest,
|
|
|
|
|
|
|
|
onError: any,
|
|
|
|
|
|
|
|
errorLabel: string
|
|
|
|
|
|
|
|
): Observable<ForgotFileIDResponse> {
|
|
|
|
this.setPublicFields(request);
|
|
|
|
this.setPublicFields(request);
|
|
|
|
request.TokenID = '';
|
|
|
|
request.TokenID = "";
|
|
|
|
request.PatientIdentificationID = '';
|
|
|
|
request.PatientIdentificationID = "";
|
|
|
|
request.PatientID = 0;
|
|
|
|
// request.PatientID = 0;
|
|
|
|
request.SearchType = 2;
|
|
|
|
request.SearchType = 2;
|
|
|
|
request.isRegister = false;
|
|
|
|
request.isRegister = false;
|
|
|
|
return this.con.post(AuthenticationService.forgotFileIDURL, request, onError, errorLabel);
|
|
|
|
return this.con.post(
|
|
|
|
|
|
|
|
AuthenticationService.forgotFileIDURL,
|
|
|
|
|
|
|
|
request,
|
|
|
|
|
|
|
|
onError,
|
|
|
|
|
|
|
|
errorLabel
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public isSAUDIIDValid(id: string): boolean {
|
|
|
|
public isSAUDIIDValid(id: string): boolean {
|
|
|
|
if (!id) {
|
|
|
|
if (!id) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
@ -470,48 +569,44 @@ export class AuthenticationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < 10; i++) {
|
|
|
|
for (let i = 0; i < 10; i++) {
|
|
|
|
if ((i % 2) === 0) {
|
|
|
|
if (i % 2 === 0) {
|
|
|
|
const a = id.charAt(i);
|
|
|
|
const a = id.charAt(i);
|
|
|
|
const x = Number(a) * 2;
|
|
|
|
const x = Number(a) * 2;
|
|
|
|
let b = x.toString();
|
|
|
|
let b = x.toString();
|
|
|
|
if (b.length === 1) {
|
|
|
|
if (b.length === 1) {
|
|
|
|
b = '0' + b;
|
|
|
|
b = "0" + b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sum += Number(b.charAt(0)) + Number(b.charAt(1));
|
|
|
|
sum += Number(b.charAt(0)) + Number(b.charAt(1));
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
sum += Number(id.charAt(i));
|
|
|
|
sum += Number(id.charAt(i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ((sum % 10) === 0);
|
|
|
|
return sum % 10 === 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public checkUserHasEmailDialog(): Observable<void> {
|
|
|
|
public checkUserHasEmailDialog(): Observable<void> {
|
|
|
|
|
|
|
|
|
|
|
|
return Observable.create(observer => {
|
|
|
|
return Observable.create(observer => {
|
|
|
|
if (this.isAuthenticatedUserHasRealEmail()) {
|
|
|
|
if (this.isAuthenticatedUserHasRealEmail()) {
|
|
|
|
const message = this.ts.trPK('general', 'send-email')
|
|
|
|
const message = this.ts
|
|
|
|
.replace('[0]', this.getAuthenticatedUser().EmailAddress);
|
|
|
|
.trPK("general", "send-email")
|
|
|
|
this.cs.presentConfirmDialog(message,
|
|
|
|
.replace("[0]", this.getAuthenticatedUser().EmailAddress);
|
|
|
|
() => {
|
|
|
|
this.cs.presentConfirmDialog(message, () => {
|
|
|
|
observer.next();
|
|
|
|
observer.next();
|
|
|
|
observer.complete();
|
|
|
|
observer.complete();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.cs.presentConfirmDialog(this.ts.trPK('login', 'enter-email'),
|
|
|
|
this.cs.presentConfirmDialog(
|
|
|
|
|
|
|
|
this.ts.trPK("login", "enter-email"),
|
|
|
|
() => {
|
|
|
|
() => {
|
|
|
|
//this.cs.openPatientProfile();
|
|
|
|
//this.cs.openPatientProfile();
|
|
|
|
observer.complete();
|
|
|
|
observer.complete();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
@ -529,9 +624,12 @@ export class AuthenticationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private sessionTimeOutDialog() {
|
|
|
|
private sessionTimeOutDialog() {
|
|
|
|
this.cs.presentConfirmDialog(this.ts.trPK('general', 'idle-relogin'), () => {
|
|
|
|
this.cs.presentConfirmDialog(
|
|
|
|
|
|
|
|
this.ts.trPK("general", "idle-relogin"),
|
|
|
|
|
|
|
|
() => {
|
|
|
|
// this.cs.openUserLogin();
|
|
|
|
// this.cs.openUserLogin();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
@ -561,20 +659,19 @@ export class AuthenticationService {
|
|
|
|
if (!AuthenticationService.eventsRegistered) {
|
|
|
|
if (!AuthenticationService.eventsRegistered) {
|
|
|
|
AuthenticationService.eventsRegistered = true;
|
|
|
|
AuthenticationService.eventsRegistered = true;
|
|
|
|
// every time we have and event
|
|
|
|
// every time we have and event
|
|
|
|
this.registerDocumentEvents(['mousedown', 'touchstart', 'click', 'keyup'], () => {
|
|
|
|
this.registerDocumentEvents(
|
|
|
|
|
|
|
|
["mousedown", "touchstart", "click", "keyup"],
|
|
|
|
|
|
|
|
() => {
|
|
|
|
// if user still logged in and session not expired
|
|
|
|
// if user still logged in and session not expired
|
|
|
|
if (AuthenticationService.user && !AuthenticationService.requireRelogin) {
|
|
|
|
if (
|
|
|
|
|
|
|
|
AuthenticationService.user &&
|
|
|
|
|
|
|
|
!AuthenticationService.requireRelogin
|
|
|
|
|
|
|
|
) {
|
|
|
|
// reset and start idling timer
|
|
|
|
// reset and start idling timer
|
|
|
|
this.detectIdle();
|
|
|
|
this.detectIdle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|