|
|
|
|
@ -32,73 +32,72 @@ import { ForgetPassword } from 'src/app/authentication/models/forget.password';
|
|
|
|
|
providedIn: "root"
|
|
|
|
|
})
|
|
|
|
|
export class AuthenticationService {
|
|
|
|
|
public static MOBILE_USER = 102;
|
|
|
|
|
|
|
|
|
|
/* login methods */
|
|
|
|
|
public static loginURL =
|
|
|
|
|
"Services/Authentication.svc/REST/CheckPatientAuthentication";
|
|
|
|
|
public static checkUserAuthURL =
|
|
|
|
|
"Services/Authentication.svc/REST/CheckPatientAuthentication";
|
|
|
|
|
|
|
|
|
|
public static login = "Services/ERP.svc/REST/MemberLogin";
|
|
|
|
|
|
|
|
|
|
public static activationCodeURL =
|
|
|
|
|
"Services/Authentication.svc/REST/CheckActivationCode";
|
|
|
|
|
public static getLoginInfoURL =
|
|
|
|
|
"Services/Authentication.svc/REST/GetMobileLoginInfo";
|
|
|
|
|
|
|
|
|
|
public static smsCheck = "Services/ERP.svc/REST/CheckActivationCode";
|
|
|
|
|
public static smsCheckForget =
|
|
|
|
|
"Services/ERP.svc/REST/CheckPublicActivationCode";
|
|
|
|
|
public static smsSendCode = "Services/ERP.svc/REST/SendPublicActivationCode";
|
|
|
|
|
|
|
|
|
|
/* register methods */
|
|
|
|
|
|
|
|
|
|
public static checkPatientForRegisterationURL =
|
|
|
|
|
"Services/Authentication.svc/REST/CheckPatientForRegisteration";
|
|
|
|
|
public static sendSmsForRegisterURL =
|
|
|
|
|
"Services/Authentication.svc/REST/SendSMSForPatientRegisteration";
|
|
|
|
|
public static registerTempUserURL =
|
|
|
|
|
"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 LOGIN_EVENT = "user-login-event";
|
|
|
|
|
public static FAMILY_LOGIN_EVENT = "family-login-event";
|
|
|
|
|
public static AUTHENTICATED_USER_KEY = "save-authenticated-user";
|
|
|
|
|
|
|
|
|
|
// private static user: AuthenticatedUser;
|
|
|
|
|
constructor(
|
|
|
|
|
public con: ConnectorService,
|
|
|
|
|
public cs: CommonService,
|
|
|
|
|
public ts: TranslatorService,
|
|
|
|
|
public nativeStorage: NativeStorage,
|
|
|
|
|
public localNotifications: UserLocalNotificationService,
|
|
|
|
|
private events: Events
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
public authenticateRequest(request: Request, automaticLogin = true): Request {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
const user = this.getAuthenticatedUser();
|
|
|
|
|
if (user) {
|
|
|
|
|
/*user with eye prescriptions*/
|
|
|
|
|
request.P_SESSION_ID = user.P_SESSION_ID;
|
|
|
|
|
request.MobileNumber = user.EMPLOYEE_MOBILE_NUMBER;
|
|
|
|
|
request.LogInTokenID = user.LogInTokenID;
|
|
|
|
|
request.TokenID = user.TokenID;
|
|
|
|
|
request.P_USER_NAME = user.EMPLOYEE_NUMBER;
|
|
|
|
|
request.UserName = user.EMPLOYEE_NUMBER;
|
|
|
|
|
if (AuthenticationService.requireRelogin) {
|
|
|
|
|
this.sessionTimeOutDialog();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.cs.userNeedToReLogin();
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static MOBILE_USER = 102;
|
|
|
|
|
|
|
|
|
|
/* login methods */
|
|
|
|
|
public static loginURL = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
|
|
|
|
|
public static checkUserAuthURL = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
|
|
|
|
|
|
|
|
|
|
public static login = 'Services/ERP.svc/REST/MemberLogin';
|
|
|
|
|
|
|
|
|
|
public static activationCodeURL = 'Services/Authentication.svc/REST/CheckActivationCode';
|
|
|
|
|
public static getLoginInfoURL = 'Services/Authentication.svc/REST/GetMobileLoginInfo';
|
|
|
|
|
|
|
|
|
|
public static smsCheck='Services/ERP.svc/REST/CheckActivationCode';
|
|
|
|
|
public static smsCheckForget='Services/ERP.svc/REST/CheckPublicActivationCode';
|
|
|
|
|
public static smsSendCode='Services/ERP.svc/REST/SendPublicActivationCode';
|
|
|
|
|
|
|
|
|
|
/* register methods */
|
|
|
|
|
|
|
|
|
|
public static checkPatientForRegisterationURL = 'Services/Authentication.svc/REST/CheckPatientForRegisteration';
|
|
|
|
|
public static sendSmsForRegisterURL = 'Services/Authentication.svc/REST/SendSMSForPatientRegisteration';
|
|
|
|
|
public static registerTempUserURL = '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;
|
|
|
|
|
|
|
|
|
|
/*user checking methods */
|
|
|
|
|
public static userChecking = 'Services/ERP.svc/REST/Get_BasicUserInformation';
|
|
|
|
|
public static changePasswordForget ='Services/ERP.svc/REST/ChangePassword_Forget';
|
|
|
|
|
|
|
|
|
|
public static LOGIN_EVENT = 'user-login-event';
|
|
|
|
|
public static FAMILY_LOGIN_EVENT = 'family-login-event';
|
|
|
|
|
public static AUTHENTICATED_USER_KEY = 'save-authenticated-user';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// private static user: AuthenticatedUser;
|
|
|
|
|
constructor(
|
|
|
|
|
public con: ConnectorService,
|
|
|
|
|
public cs: CommonService,
|
|
|
|
|
public ts: TranslatorService,
|
|
|
|
|
public nativeStorage: NativeStorage,
|
|
|
|
|
public localNotifications: UserLocalNotificationService,
|
|
|
|
|
private events: Events
|
|
|
|
|
) { }
|
|
|
|
|
|
|
|
|
|
public authenticateRequest(request: Request, automaticLogin = true): Request {
|
|
|
|
|
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
const user = this.getAuthenticatedUser();
|
|
|
|
|
if (user) {
|
|
|
|
|
request.P_SESSION_ID = user.P_SESSION_ID;
|
|
|
|
|
request.MobileNumber = user.EMPLOYEE_MOBILE_NUMBER;
|
|
|
|
|
request.LogInTokenID = user.LogInTokenID;
|
|
|
|
|
request.TokenID = user.TokenID;
|
|
|
|
|
request.P_USER_NAME = user.EMPLOYEE_NUMBER;
|
|
|
|
|
request.UserName = user.EMPLOYEE_NUMBER;
|
|
|
|
|
if (AuthenticationService.requireRelogin) {
|
|
|
|
|
this.sessionTimeOutDialog();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.cs.userNeedToReLogin();
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
else {
|
|
|
|
|
if (automaticLogin) {
|
|
|
|
|
this.cs.openUserLogin();
|
|
|
|
|
@ -118,7 +117,6 @@ export class AuthenticationService {
|
|
|
|
|
//request.isDentalAllowedBackend = false;
|
|
|
|
|
return request;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public authenticateAndSetPersonalInformation(
|
|
|
|
|
request: EmailRequest,
|
|
|
|
|
examinationInfo?: any
|
|
|
|
|
@ -164,71 +162,67 @@ export class AuthenticationService {
|
|
|
|
|
return request;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public getAuthenticatedRequest(login = true): Request {
|
|
|
|
|
const request = new Request();
|
|
|
|
|
this.authenticateRequest(request, login);
|
|
|
|
|
return request;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getPublicRequest(): Request {
|
|
|
|
|
const request = new Request();
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
return request;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public login(
|
|
|
|
|
request: LoginRequest,
|
|
|
|
|
onError: any,
|
|
|
|
|
errorLabel: string
|
|
|
|
|
): Observable<Response> {
|
|
|
|
|
request.PatientID = 0;
|
|
|
|
|
request.TokenID = "";
|
|
|
|
|
request.isDentalAllowedBackend = false;
|
|
|
|
|
request.isRegister = false;
|
|
|
|
|
return this.con.post(
|
|
|
|
|
AuthenticationService.loginURL,
|
|
|
|
|
request,
|
|
|
|
|
onError,
|
|
|
|
|
errorLabel
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public isAuthenticated(): boolean {
|
|
|
|
|
return AuthenticationService.user != null;
|
|
|
|
|
}
|
|
|
|
|
public getPublicRequest(): Request {
|
|
|
|
|
const request = new Request();
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
return request;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* this fucntion load from user information if he logged in before
|
|
|
|
|
* and save user into memory and local storage
|
|
|
|
|
* disable notifications for previous user if new user logged in with different user
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* info:
|
|
|
|
|
* 1- user stored in local storage without token
|
|
|
|
|
* @param result check activation code result
|
|
|
|
|
*/
|
|
|
|
|
public setAuthenticatedUser(
|
|
|
|
|
result: CheckActivationCodeResponse
|
|
|
|
|
): Observable<boolean> {
|
|
|
|
|
return Observable.create(observer => {
|
|
|
|
|
this.loadAuthenticatedUser().subscribe(
|
|
|
|
|
(loadedUser: AuthenticatedUser) => {
|
|
|
|
|
AuthenticationService.requireRelogin = false;
|
|
|
|
|
this.startIdleMonitoring();
|
|
|
|
|
const user = this.updateAuthenticatedUser(result, loadedUser);
|
|
|
|
|
/* we store in hd without token but with token in memory*/
|
|
|
|
|
this.saveUserInStorage(user).subscribe((success: boolean) => {
|
|
|
|
|
AuthenticationService.user = user;
|
|
|
|
|
|
|
|
|
|
this.publishUserChangeEvent();
|
|
|
|
|
observer.next(true);
|
|
|
|
|
observer.complete();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public login(request: LoginRequest, onError: any, errorLabel: string): Observable<Response> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
return this.con.post(AuthenticationService.login, request, onError, errorLabel);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public isAuthenticated(): boolean {
|
|
|
|
|
return AuthenticationService.user != null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* this fucntion load from user information if he logged in before
|
|
|
|
|
* and save user into memory and local storage
|
|
|
|
|
* disable notifications for previous user if new user logged in with different user
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* info:
|
|
|
|
|
* 1- user stored in local storage without token
|
|
|
|
|
* @param result check activation code result
|
|
|
|
|
*/
|
|
|
|
|
public setAuthenticatedUser(
|
|
|
|
|
result: CheckActivationCodeResponse
|
|
|
|
|
): Observable<boolean> {
|
|
|
|
|
return Observable.create(observer => {
|
|
|
|
|
this.loadAuthenticatedUser().subscribe(
|
|
|
|
|
(loadedUser: AuthenticatedUser) => {
|
|
|
|
|
AuthenticationService.requireRelogin = false;
|
|
|
|
|
this.startIdleMonitoring();
|
|
|
|
|
const user = this.updateAuthenticatedUser(result, loadedUser);
|
|
|
|
|
/* we store in hd without token but with token in memory*/
|
|
|
|
|
this.saveUserInStorage(user).subscribe((success: boolean) => {
|
|
|
|
|
AuthenticationService.user = user;
|
|
|
|
|
|
|
|
|
|
this.publishUserChangeEvent();
|
|
|
|
|
observer.next(true);
|
|
|
|
|
observer.complete();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public resetAuthenticatedUser(user: AuthenticatedUser) {
|
|
|
|
|
AuthenticationService.user = user;
|
|
|
|
|
AuthenticationService.requireRelogin = false;
|
|
|
|
|
@ -260,7 +254,6 @@ export class AuthenticationService {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public setDeviceToken(token: string) {
|
|
|
|
|
const user = this.getAuthenticatedUser();
|
|
|
|
|
if (user) {
|
|
|
|
|
@ -355,7 +348,6 @@ export class AuthenticationService {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* signout
|
|
|
|
|
*clear user session and storage information
|
|
|
|
|
@ -428,52 +420,41 @@ export class AuthenticationService {
|
|
|
|
|
return AuthenticationService.user;
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
return AuthenticationService.user;
|
|
|
|
|
}
|
|
|
|
|
return AuthenticationService.user;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public checkUserAuthentication(
|
|
|
|
|
request: CheckUserAuthenticationRequest,
|
|
|
|
|
onError: any,
|
|
|
|
|
errorLabel: string
|
|
|
|
|
): Observable<CheckUserAuthenticationResponse> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
return this.con.post(
|
|
|
|
|
AuthenticationService.login,
|
|
|
|
|
request,
|
|
|
|
|
onError,
|
|
|
|
|
errorLabel
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public checkActivationCode(
|
|
|
|
|
request: CheckActivationCodeRequest,
|
|
|
|
|
onError: any,
|
|
|
|
|
errorLabel: string
|
|
|
|
|
): Observable<CheckActivationCodeResponse> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
return this.con.post(
|
|
|
|
|
AuthenticationService.activationCodeURL,
|
|
|
|
|
request,
|
|
|
|
|
onError,
|
|
|
|
|
errorLabel
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
public checkUserAuthentication(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string)
|
|
|
|
|
: Observable<CheckUserAuthenticationResponse> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
return this.con.post(AuthenticationService.userChecking, request, onError, errorLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public checkSMS(
|
|
|
|
|
request: SMSCheckRequest,
|
|
|
|
|
onError: any,
|
|
|
|
|
errorLabel: string
|
|
|
|
|
): Observable<SMSCheckResponse> {
|
|
|
|
|
//this.setPublicFields(request);
|
|
|
|
|
return this.con.post(
|
|
|
|
|
AuthenticationService.smsCheck,
|
|
|
|
|
request,
|
|
|
|
|
onError,
|
|
|
|
|
errorLabel
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
public checkActivationCode(request: CheckActivationCodeRequest, onError: any, errorLabel: string)
|
|
|
|
|
: Observable<CheckActivationCodeResponse> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
public checkSMS(request: SMSCheckRequest, onError: any, errorLabel: string)
|
|
|
|
|
: Observable<SMSCheckResponse> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
return this.con.post(AuthenticationService.smsCheck, request, onError, errorLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public checkForgetSMS(request: SMSCheckRequest, onError: any, errorLabel: string)
|
|
|
|
|
: Observable<SMSCheckResponse> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
return this.con.post(AuthenticationService.smsCheckForget, request, onError, errorLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public sendPublicSMS(request: SMSCheckRequest, onError: any, errorLabel: string)
|
|
|
|
|
: Observable<CheckUserAuthenticationResponse> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
return this.con.post(AuthenticationService.smsSendCode, request, onError, errorLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
client side:
|
|
|
|
|
id no , mobile no , zip code
|
|
|
|
|
*/
|
|
|
|
|
@ -482,112 +463,90 @@ export class AuthenticationService {
|
|
|
|
|
client side:
|
|
|
|
|
id no , mobile no , zip code
|
|
|
|
|
*/
|
|
|
|
|
public sendSmsForPatientRegisteration(
|
|
|
|
|
request: CheckPatientRegisterationRequest,
|
|
|
|
|
onError: any,
|
|
|
|
|
errorLabel: string
|
|
|
|
|
): Observable<CheckUserAuthenticationResponse> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
request.TokenID = "";
|
|
|
|
|
request.isRegister = false;
|
|
|
|
|
return this.con.post(
|
|
|
|
|
AuthenticationService.sendSmsForRegisterURL,
|
|
|
|
|
request,
|
|
|
|
|
onError,
|
|
|
|
|
errorLabel
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
public sendSmsForPatientRegisteration(request: CheckPatientRegisterationRequest, onError: any, errorLabel: string)
|
|
|
|
|
: Observable<CheckUserAuthenticationResponse> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
request.TokenID = '';
|
|
|
|
|
request.isRegister = false;
|
|
|
|
|
return this.con.post(AuthenticationService.sendSmsForRegisterURL, request, onError, errorLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public checkRegisterationActivationCode(
|
|
|
|
|
request: CheckRegisterationCodeRequest,
|
|
|
|
|
onError: any,
|
|
|
|
|
errorLabel: string
|
|
|
|
|
): Observable<Response> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
return this.con.post(
|
|
|
|
|
AuthenticationService.activationCodeURL,
|
|
|
|
|
request,
|
|
|
|
|
onError,
|
|
|
|
|
errorLabel
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
public checkRegisterationActivationCode(request: CheckRegisterationCodeRequest, onError: any, errorLabel: string)
|
|
|
|
|
: Observable<Response> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public sendSMSForForgotFileNumber(
|
|
|
|
|
request: CheckUserAuthenticationRequest,
|
|
|
|
|
onError: any,
|
|
|
|
|
errorLabel: string
|
|
|
|
|
): Observable<CheckUserAuthenticationResponse> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
request.TokenID = "";
|
|
|
|
|
// request.PatientIdentificationID = '';
|
|
|
|
|
// request.PatientID = 0;
|
|
|
|
|
//request.SearchType = 2;
|
|
|
|
|
//request.isRegister = false;
|
|
|
|
|
return this.con.post(
|
|
|
|
|
AuthenticationService.sendSMSForgotFileNoURL,
|
|
|
|
|
request,
|
|
|
|
|
onError,
|
|
|
|
|
errorLabel
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
public sendForgetPassword(request: ForgetPassword, onError: any, errorLabel: string)
|
|
|
|
|
: Observable<CheckUserAuthenticationResponse> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
return this.con.post(AuthenticationService.smsSendCode, request, onError, errorLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public forgotFileIdActivation(
|
|
|
|
|
request: CheckActivationCodeRequest,
|
|
|
|
|
onError: any,
|
|
|
|
|
errorLabel: string
|
|
|
|
|
): Observable<ForgotFileIDResponse> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
request.TokenID = "";
|
|
|
|
|
request.PatientIdentificationID = "";
|
|
|
|
|
// request.PatientID = 0;
|
|
|
|
|
request.SearchType = 2;
|
|
|
|
|
request.isRegister = false;
|
|
|
|
|
return this.con.post(
|
|
|
|
|
AuthenticationService.forgotFileIDURL,
|
|
|
|
|
request,
|
|
|
|
|
onError,
|
|
|
|
|
errorLabel
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
public submitForgetPassword(request: ForgetPassword, onError: any, errorLabel: string)
|
|
|
|
|
: Observable<CheckUserAuthenticationResponse> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
return this.con.post(AuthenticationService.changePasswordForget, request, onError, errorLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public isSAUDIIDValid(id: string): boolean {
|
|
|
|
|
if (!id) {
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
public sendSMSForForgotFileNumber(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string)
|
|
|
|
|
: Observable<CheckUserAuthenticationResponse> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
request.TokenID = '';
|
|
|
|
|
//request.SearchType = 2;
|
|
|
|
|
//request.isRegister = false;
|
|
|
|
|
return this.con.post(AuthenticationService.sendSMSForgotFileNoURL, request, onError, errorLabel);
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
id = id.toString();
|
|
|
|
|
id = id.trim();
|
|
|
|
|
const returnValue = Number(id);
|
|
|
|
|
let sum = 0;
|
|
|
|
|
if (returnValue > 0) {
|
|
|
|
|
const type = Number(id.charAt(0));
|
|
|
|
|
|
|
|
|
|
if (id.length !== 10) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (type !== 2 && type !== 1) {
|
|
|
|
|
|
|
|
|
|
public forgotFileIdActivation(request: CheckActivationCodeRequest, onError: any, errorLabel: string)
|
|
|
|
|
: Observable<ForgotFileIDResponse> {
|
|
|
|
|
this.setPublicFields(request);
|
|
|
|
|
request.TokenID = '';
|
|
|
|
|
request.SearchType = 2;
|
|
|
|
|
request.isRegister = false;
|
|
|
|
|
return this.con.post(AuthenticationService.forgotFileIDURL, request, onError, errorLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public isSAUDIIDValid(id: string): boolean {
|
|
|
|
|
if (!id) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < 10; i++) {
|
|
|
|
|
if (i % 2 === 0) {
|
|
|
|
|
const a = id.charAt(i);
|
|
|
|
|
const x = Number(a) * 2;
|
|
|
|
|
let b = x.toString();
|
|
|
|
|
if (b.length === 1) {
|
|
|
|
|
b = "0" + b;
|
|
|
|
|
try {
|
|
|
|
|
id = id.toString();
|
|
|
|
|
id = id.trim();
|
|
|
|
|
const returnValue = Number(id);
|
|
|
|
|
let sum = 0;
|
|
|
|
|
if (returnValue > 0) {
|
|
|
|
|
const type = Number(id.charAt(0));
|
|
|
|
|
|
|
|
|
|
if (id.length !== 10) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (type !== 2 && type !== 1) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
sum += Number(b.charAt(0)) + Number(b.charAt(1));
|
|
|
|
|
} else {
|
|
|
|
|
sum += Number(id.charAt(i));
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < 10; i++) {
|
|
|
|
|
if (i % 2 === 0) {
|
|
|
|
|
const a = id.charAt(i);
|
|
|
|
|
const x = Number(a) * 2;
|
|
|
|
|
let b = x.toString();
|
|
|
|
|
if (b.length === 1) {
|
|
|
|
|
b = "0" + b;
|
|
|
|
|
}
|
|
|
|
|
sum += Number(b.charAt(0)) + Number(b.charAt(1));
|
|
|
|
|
} else {
|
|
|
|
|
sum += Number(id.charAt(i));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return sum % 10 === 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return sum % 10 === 0;
|
|
|
|
|
} catch (err) {}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public checkUserHasEmailDialog(): Observable<void> {
|
|
|
|
|
return Observable.create(observer => {
|
|
|
|
|
if (this.isAuthenticatedUserHasRealEmail()) {
|
|
|
|
|
|