diff --git a/Mohem/src/app/authentication/forgot/forgot.component.html b/Mohem/src/app/authentication/forgot/forgot.component.html
index caaaa9df..1bc60365 100644
--- a/Mohem/src/app/authentication/forgot/forgot.component.html
+++ b/Mohem/src/app/authentication/forgot/forgot.component.html
@@ -1,42 +1,33 @@
-
-
- {{'login,forgot-password' | translate}}
-
+
+
-
- {{'changePassword.newPassword' | translate}}
-
-
-
-
-
-
- {{'changePassword.confirmPassword' | translate}}
-
-
-
+
+ {{ts.trPK('login','username')}}
+
+
+
-
-
\ No newline at end of file
+
+
+
+
+
+ {{ts.trPK('login','changepassword')}}
+
+
\ No newline at end of file
diff --git a/Mohem/src/app/authentication/forgot/forgot.component.scss b/Mohem/src/app/authentication/forgot/forgot.component.scss
index e69de29b..e8ab06f1 100644
--- a/Mohem/src/app/authentication/forgot/forgot.component.scss
+++ b/Mohem/src/app/authentication/forgot/forgot.component.scss
@@ -0,0 +1,7 @@
+ .header-toolbar{
+ --background: linear-gradient(45deg, #3ac1f1 0%, #19a163 36%, #19a163 59%, #1a586d 100%);
+}
+
+.btnBack{
+ background: transparent;
+}
\ No newline at end of file
diff --git a/Mohem/src/app/authentication/login/login.component.html b/Mohem/src/app/authentication/login/login.component.html
index 9de58fab..ae7a3c56 100644
--- a/Mohem/src/app/authentication/login/login.component.html
+++ b/Mohem/src/app/authentication/login/login.component.html
@@ -31,8 +31,8 @@
{{ts.trPK('login','signup')}}
-
-
+
+
diff --git a/Mohem/src/app/authentication/login/login.component.scss b/Mohem/src/app/authentication/login/login.component.scss
index 65e02773..08f6520a 100644
--- a/Mohem/src/app/authentication/login/login.component.scss
+++ b/Mohem/src/app/authentication/login/login.component.scss
@@ -1,11 +1,15 @@
.signupDiv {
font-size: 14px;
}
-
.customGrid {
margin-bottom: 20px;
}
-
+.gridBtn.active{
+ background:var(--customnavy) !important;
+ color:var(--light) !important;
+
+}
+.gridDiv{direction: rtl}
.pageTitle {
color: var(--dark);
font-size: 23px;
diff --git a/Mohem/src/app/authentication/login/login.component.ts b/Mohem/src/app/authentication/login/login.component.ts
index fcb916f8..d5e5bfde 100644
--- a/Mohem/src/app/authentication/login/login.component.ts
+++ b/Mohem/src/app/authentication/login/login.component.ts
@@ -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',
@@ -36,6 +35,12 @@ export class LoginComponent implements OnInit, OnDestroy {
private language: string;
private username : string;
+ private currentLang : any;
+ private patientOutSA: boolean;
+ private loginTokenID: string;
+ private isMobileFingerPrint: boolean;
+ private FingerPrintPatientIdentificationID: string;
+ private loginData = new LoginModel();
constructor(
public cs: CommonService,
public authService: AuthenticationService,
@@ -46,7 +51,8 @@ export class LoginComponent implements OnInit, OnDestroy {
private faio: FingerprintAIO,
public ngZone: NgZone,
public device: Device,
- public splash: SplashScreen
+ public splash: SplashScreen,
+ public sharedData: SharedDataService
) {
}
@@ -56,6 +62,7 @@ export class LoginComponent implements OnInit, OnDestroy {
this.checkIfLoggedInBefore();
// this.splash.hide();
}, 100);
+ this.currentLang = TranslatorService.getCurrentLanguageCode();
}
ngOnDestroy(): void {
@@ -71,6 +78,8 @@ export class LoginComponent implements OnInit, OnDestroy {
else{
this.language = "AR";
}
+ this.currentLang = TranslatorService.getCurrentLanguageCode();
+ console.log(this.currentLang);
}
private checkIfLoggedInBefore() {
this.cs.startLoading();
@@ -357,18 +366,10 @@ export class LoginComponent implements OnInit, OnDestroy {
() => {
}, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => {
if (this.cs.validResponse(result)) {
- console.log(result);
+ console.log(result);
+ this.loginData.LogInTokenID = result.LogInTokenID;
+ this.sharedData.setSharedData(this.loginData, "logindata");
this.cs.openSMSPage();
- this.loginTokenID = result.LogInTokenID;
- this.patientOutSA = result.PatientOutSA;
- this.isMobileFingerPrint = false;
- this.FingerPrintPatientIdentificationID = '';
- if (result.isSMSSent) {
- this.startListeneingForSMS();
- } else {
- this.smsService.stopSMSMonitoring();
- this.checkActivationCode();
- }
}
});
}
@@ -397,11 +398,6 @@ export class LoginComponent implements OnInit, OnDestroy {
}, null, title);
}
- private patientOutSA: boolean;
- private loginTokenID: string;
- private isMobileFingerPrint: boolean;
- private FingerPrintPatientIdentificationID: string;
-
private checkActivationCode(readedCode?) {
/*const request = new CheckActivationCodeRequest();
request.IsMobileFingerPrint = this.isMobileFingerPrint;
@@ -445,7 +441,7 @@ export class LoginComponent implements OnInit, OnDestroy {
if (this.authService.isAgreedBefore()) {
this.cs.openHome();
} else {
- //this.cs.openAgreement();
+ // this.cs.openAgreement();
}
});
}
diff --git a/Mohem/src/app/authentication/models/LoginModel.ts b/Mohem/src/app/authentication/models/LoginModel.ts
new file mode 100644
index 00000000..5d6a885f
--- /dev/null
+++ b/Mohem/src/app/authentication/models/LoginModel.ts
@@ -0,0 +1,6 @@
+export class LoginModel {
+ LogInTokenID: string;
+ activationCode: string;
+ P_USER_NAME: string;
+ MobileNumber: string;
+}
diff --git a/Mohem/src/app/authentication/sms-page/sms-page.module.ts b/Mohem/src/app/authentication/sms-page/sms-page.module.ts
index 049e14a0..a14a2b6c 100644
--- a/Mohem/src/app/authentication/sms-page/sms-page.module.ts
+++ b/Mohem/src/app/authentication/sms-page/sms-page.module.ts
@@ -9,7 +9,7 @@ import { SmsPagePage } from './sms-page.page';
const routes: Routes = [
{
- path: 'smspage',
+ path: '',
component: SmsPagePage
}
];
diff --git a/Mohem/src/app/authentication/sms-page/sms-page.page.html b/Mohem/src/app/authentication/sms-page/sms-page.page.html
index c49cc795..e6d46f1b 100644
--- a/Mohem/src/app/authentication/sms-page/sms-page.page.html
+++ b/Mohem/src/app/authentication/sms-page/sms-page.page.html
@@ -1,7 +1,10 @@
-
- {{'verificationcode.verificationcode' | translate}}
-
+
@@ -13,7 +16,7 @@
- {{'verificationcode.title' | translate}}{{'verificationcode.verificationcode' | translate}} {{'verificationcode.by' | translate}}{{'verificationcode.sms' | translate}}{{'verificationcode.instruct' | translate}}{{'general.submit' | translate}}
+ {{'verificationcode,title' | translate}}{{'verificationcode,verificationcode' | translate}} {{'verificationcode,by' | translate}}{{'verificationcode,sms' | translate}}{{'verificationcode,instruct' | translate}}{{'general,submit' | translate}}
@@ -23,7 +26,7 @@
{{displayTime}}
- {{'verificationcode.verificationcode' | translate}}
+ {{'verificationcode,verificationcode' | translate}}
@@ -31,6 +34,6 @@
-
+ {{'general,submit' | translate}}
\ No newline at end of file
diff --git a/Mohem/src/app/authentication/sms-page/sms-page.page.scss b/Mohem/src/app/authentication/sms-page/sms-page.page.scss
index e69de29b..5f1c67eb 100644
--- a/Mohem/src/app/authentication/sms-page/sms-page.page.scss
+++ b/Mohem/src/app/authentication/sms-page/sms-page.page.scss
@@ -0,0 +1,21 @@
+.header-toolbar{
+ --background: linear-gradient(45deg, #3ac1f1 0%, #19a163 36%, #19a163 59%, #1a586d 100%);
+}
+
+.btnBack{
+ background: transparent;
+}
+
+ion-img{
+ width: 180px;
+ height: 180px;
+ background:transparent;
+}
+
+h1{
+ font-size: 28px !important;
+}
+
+span{
+ font-weight: bold;
+}
\ No newline at end of file
diff --git a/Mohem/src/app/authentication/sms-page/sms-page.page.ts b/Mohem/src/app/authentication/sms-page/sms-page.page.ts
index 9d67eec3..7a07a8aa 100644
--- a/Mohem/src/app/authentication/sms-page/sms-page.page.ts
+++ b/Mohem/src/app/authentication/sms-page/sms-page.page.ts
@@ -1,9 +1,15 @@
import { Component, OnInit } from '@angular/core';
-import { ElementRef} from '@angular/core';
+import { ElementRef } from '@angular/core';
import { NavController } from '@ionic/angular';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
+import { SMSCheckRequest } from 'src/app/hmg-common/services/authentication/models/smscheck.request';
+import { LoginModel } from '../models/LoginModel';
+import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
+import { SMSCheckResponse } from 'src/app/hmg-common/services/authentication/models/smscheck.response';
+
+
@Component({
selector: 'app-sms-page',
templateUrl: './sms-page.page.html',
@@ -11,28 +17,133 @@ import { SharedDataService } from 'src/app/hmg-common/services/shared-data-servi
})
export class SmsPagePage implements OnInit {
- Channel: number=0;
+ Channel: number = 0;
activationCode: string;
- P_SESSION_ID: number;
+ P_SESSION_ID: number;
timeInSeconds: any;
- time:any;
- runTimer:any;
+ time: any;
+ runTimer: any;
hasStarted: any;
hasFinished: any;
- remainingTime:any;
- displayTime:any;
- loginTokenID:string;
-public isForgetPwd:boolean=false;
-public isExpiredPwd:boolean=false;
-public count:number=0;
+ remainingTime: any;
+ displayTime: any;
+ loginTokenID: string;
+ public isForgetPwd: boolean = false;
+ public isExpiredPwd: boolean = false;
+ public count: number = 0;
+ private loginData = new LoginModel();
constructor(public navCtrl: NavController,
public translate: TranslatorService,
- public common:CommonService,
- private elementRef:ElementRef,
- public sharedData:SharedDataService) { }
+ public common: CommonService,
+ private elementRef: ElementRef,
+ public authService: AuthenticationService,
+ public sharedData: SharedDataService) { }
ngOnInit() {
+ this.count = 0;
+ this.initTimer();
+ this.startTimer();
+
+ }
+
+ initTimer() {
+ // Pomodoro is usually for 25 minutes
+ if (!this.timeInSeconds) {
+ this.timeInSeconds = 600;
+ }
+
+ this.time = this.timeInSeconds;
+ this.runTimer = false;
+ this.hasStarted = false;
+ this.hasFinished = false;
+ this.remainingTime = this.timeInSeconds;
+
+ this.displayTime = this.common.getSecondsAsDigitalClock(this.remainingTime);
+ }
+
+ startTimer() {
+ this.runTimer = true;
+ this.hasStarted = true;
+ this.timerTick();
+ }
+
+ pauseTimer() {
+ this.runTimer = false;
+ }
+
+ resumeTimer() {
+ this.startTimer();
+ }
+
+ timerTick() {
+ setTimeout(() => {
+
+ if (!this.runTimer) { return; }
+ this.remainingTime--;
+ this.displayTime = this.common.getSecondsAsDigitalClock(this.remainingTime);
+ if (this.remainingTime > 0) {
+ this.timerTick();
+ }
+ else {
+ this.hasFinished = true;
+ this.pauseTimer();
+ this.navCtrl.pop();
+ }
+ }, 1000);
+ }
+
+ ionViewWillLeave() {
+ this.pauseTimer();
+ }
+
+ checkVerificationCode() {
+ if (this.count < 3) {
+ if (this.activationCode == undefined || this.activationCode == null || this.activationCode == "") {
+ // this.common.showAlert(this.translate.translate('verificationcode.emptyCode'));
+ } else {
+ this.count = this.count + 1;
+ if (this.isForgetPwd || this.isExpiredPwd) {
+ this.checkForgetPwdSMS();
+ } else {
+ this.checkSMS();
+ }
+ }
+ } else {
+ let msg: string = this.translate.trPK('general', 'noOfTriesLogin');
+ //this.common.showAlert(msg);
+ //this.navCtrl.pop(); goBack
+ this.common.JustAlertDialog(this.translate.trPK("general", "ok"), msg);
+ }
+ }
+
+ public checkSMS()
+ {
+ const data = this.sharedData.getSharedData("logindata", false);
+ const request = new SMSCheckRequest();
+
+ request.LogInTokenID= data.LogInTokenID,
+ request.activationCode =this.activationCode;
+ //request.P_USER_NAME=this.userName,
+ //request.MobileNumber=this.member.MemberLoginList.P_MOBILE_NUMBER
+
+ this.authService.checkSMS(
+ request,
+ () => {
+ }, this.translate.trPK('general', 'ok')).subscribe((result: SMSCheckResponse) => {
+ console.log(result);
+ if (this.common.validResponse(result)) {
+ console.log(result);
+ //this.loginData.LogInTokenID = result.LogInTokenID;
+ //this.sharedData.setSharedData(this.loginData, "logindata");
+ //this.common.openHome();
+ }
+ });
+ }
+
+ public checkForgetPwdSMS()
+ {
+
}
}
diff --git a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts
index b5afd01e..f71a6117 100644
--- a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts
+++ b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts
@@ -24,6 +24,8 @@ import { GetLoginInfoResponse } from './models/get-login-info.response';
import { analyzeAndValidateNgModules } from '@angular/compiler';
import { Events } from '@ionic/angular';
import { InternationalMobileComponent } from '../../ui/mobile-number/international-mobile/international-mobile.component';
+import { SMSCheckRequest } from './models/smscheck.request';
+import { SMSCheckResponse } from './models/smscheck.response';
@Injectable({
providedIn: 'root'
@@ -42,6 +44,10 @@ export class AuthenticationService {
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';
@@ -433,6 +439,12 @@ export class AuthenticationService {
return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel);
}
+ public checkSMS(request: SMSCheckRequest, onError: any, errorLabel: string)
+ : Observable {
+ this.setPublicFields(request);
+ return this.con.post(AuthenticationService.smsCheck, request, onError, errorLabel);
+ }
+
/*
client side:
id no , mobile no , zip code
@@ -568,7 +580,7 @@ export class AuthenticationService {
private sessionTimeOutDialog() {
this.cs.presentConfirmDialog(this.ts.trPK('general', 'idle-relogin'), () => {
- //this.cs.openUserLogin();
+ // this.cs.openUserLogin();
});
}
diff --git a/Mohem/src/app/hmg-common/services/authentication/models/smscheck.request.ts b/Mohem/src/app/hmg-common/services/authentication/models/smscheck.request.ts
new file mode 100644
index 00000000..5c32c928
--- /dev/null
+++ b/Mohem/src/app/hmg-common/services/authentication/models/smscheck.request.ts
@@ -0,0 +1,6 @@
+import { Request } from '../../models/request';
+
+export class SMSCheckRequest extends Request {
+ LogInTokenID?: string ;
+ activationCode?: string;
+}
\ No newline at end of file
diff --git a/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts b/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts
new file mode 100644
index 00000000..b27919d1
--- /dev/null
+++ b/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts
@@ -0,0 +1,7 @@
+import { Response } from '../../models/response';
+import { AuthenticatedUser } from './authenticated-user';
+export class SMSCheckResponse extends Response {
+ AuthenticationTokenID: string;
+ PatientOutSA: boolean;
+ PatientType: number;
+}
diff --git a/Mohem/src/app/hmg-common/services/common/common.service.ts b/Mohem/src/app/hmg-common/services/common/common.service.ts
index 7cdaa3ab..e13d1fad 100644
--- a/Mohem/src/app/hmg-common/services/common/common.service.ts
+++ b/Mohem/src/app/hmg-common/services/common/common.service.ts
@@ -120,6 +120,21 @@ export class CommonService {
}
}
+
+ getSecondsAsDigitalClock(inputSeconds: number) {
+ var sec_num = parseInt(inputSeconds.toString(), 10); // don't forget the second param
+ var hours = Math.floor(sec_num / 3600);
+ var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
+ var seconds = sec_num - (hours * 3600) - (minutes * 60);
+ var hoursString = '';
+ var minutesString = '';
+ var secondsString = '';
+ hoursString = (hours < 10) ? "0" + hours : hours.toString();
+ minutesString = (minutes < 10) ? "0" + minutes : minutes.toString();
+ secondsString = (seconds < 10) ? "0" + seconds : seconds.toString();
+ return minutesString + ':' + secondsString;
+ }
+
public toastPK(page: string, key: string) {
this.toast(this.ts.trPK(page, key));
}
@@ -255,6 +270,26 @@ export class CommonService {
);
}
+ async JustAlertDialog(acceptLabel: string,
+ message: string)
+ {
+ this.clearAllAlerts();
+ const alert = await this.alertControllerIonic.create({
+ header: this.ts.trPK("general", "info"),
+ message: message,
+ buttons: [
+ {
+ text: acceptLabel,
+ handler: () => {
+ this.alertControllerIonic.dismiss();
+ }
+ }
+ ]
+ });
+ // this.alerts.push(alert);
+ await alert.present();
+ }
+
async confirmAlertDialog(
onAccept: any,
acceptLabel: string,
diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json
index c0dc70ea..3467ca8a 100644
--- a/Mohem/src/assets/localization/i18n.json
+++ b/Mohem/src/assets/localization/i18n.json
@@ -37,6 +37,10 @@
"en": "Password",
"ar": "كلمه السر"
},
+ "changepassword": {
+ "en": "Change Password",
+ "ar": "غير كلمة السر"
+ },
"forgot-your-id": {
"en": "Forgot Your Patient ID",
"ar": "هل نسيت رقم ملف المريض"
@@ -80,6 +84,37 @@
"national-id-or-iqama": {
"en": "National ID or Iqama",
"ar": "رقم الهوية أو الإقامة"
+ },
+ "sms-page":{
+ "en": "Verify OTP",
+ "ar":"تحقق مرة واحدة كلمة المرور"
+ }
+},
+"verificationcode":
+{
+ "verificationcode":{
+ "en":"Verification Code",
+ "ar":"رمز التحقق"
+ },
+ "emptyCode":{
+ "en":"Please enter the verification code",
+ "ar":"الرجاء ادخال رمز التحقق"
+ },
+ "title":{
+ "en":"You will receive a ",
+ "ar":" سوف تستلم "
+ },
+ "by":{
+ "en":" by ",
+ "ar":"عن طريق "
+ },
+ "sms":{
+ "en":"SMS",
+ "ar":" رسالة نصية "
+ },
+ "instruct":{
+ "en":" fill the code and ",
+ "ar":" ادخل الرمز و اضغط "
}
},
"general": {