Login API

MOHEMM-Q3-DEV-LATEST
ansariakhtar 7 years ago
parent 7a58598b2c
commit a787f6797d

@ -1,18 +1,19 @@
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{ path: '', redirectTo: 'authentication/login', pathMatch: 'full' },
{
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule',
data: { preload: true, delay: 1000 }
}, { path: 'sms-page', loadChildren: './authentication/sms-page/sms-page.module#SmsPagePageModule' }
const routes: Routes = [
{ path: '', redirectTo: 'authentication/login', pathMatch: 'full' },
{
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule',
data: { preload: true, delay: 1000 }
}
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }

@ -0,0 +1,112 @@
/*
header
*/
.menu-header {
height: 2.5cm;
}
.content-ios:not([no-bounce]) > .scroll-content::before {
bottom: 0;
}
.menu-header .logo {
position: absolute;
left: 0.6cm;
top: 0.9cm;
width: 1.6cm;
}
.menu-header .background {
height: 1.5cm;
width: 100%;
}
/* title */
.title-v-spacer {
height: 0.7cm;
}
.suliman-title {
margin-left: 0.3cm;
margin-right: 0.3cm;
font-weight: bold;
font-size: 0.5cm;
}
.group-title {
margin-left: 0.4cm;
margin-right: 0.4cm;
font-size: 0.4cm;
}
/*
items
*/
.items-buttons-spacer {
height: 10%;
}
/*
user information
*/
.user-v-spacer {
height: 0.5cm;
}
.user-name-title {
margin-left: 0.3cm;
margin-right: 0.3cm;
font-weight: bold;
}
.file-id-title {
margin-left: 0.4cm;
margin-right: 0.4cm;
}
.social-media-container {
position: absolute !important;
width: 100%;
bottom: 0.2cm;
background-color: white;
}
.icon-spacer {
margin-right: 0.3cm;
margin-left: 0.3cm;
}
/*mobile Landscape */
@media only screen and (min-device-height: 0px) and (max-device-height: 515px) and (orientation: landscape) {
.social-media-container {
display: none;
}
}
.info-container {
overflow-y: scroll;
width: 100%;
position: absolute;
top: 2.6cm;
bottom: 0.2cm;
padding-bottom: 4.5cm;
}
@media only screen and (orientation: landscape) {
.info-container {
padding-bottom: 0.2cm;
}
}
.member {
border-bottom-color: var(--ion-color-medium) !important;
border-bottom-width: 0.02cm;
border-bottom-style: solid;
/* margin-left: 0.4cm; */
}
.selected-member {
border-bottom-color: var(--ion-color-secondary) !important;
border-bottom-width: 0.02cm;
border-bottom-style: solid;
margin-left: 0.2cm;
}

@ -17,6 +17,7 @@ import { SearchableOptionsModule } from '../hmg-common/ui/searchable-select/sear
import { MobileNumberModule } from 'src/app/hmg-common/ui/mobile-number/mobile-number.module';
import { SmsdialogPageModule } from 'src/app/hmg-common/ui/smsdialog/smsdialog.module';
import { SmsPageModule } from 'src/app/hmg-common/ui/sms/sms.module';
import { SmsPagePage } from './sms-page/sms-page.page';
@ -36,6 +37,10 @@ const routes: Routes = [
{
path: 'agreement',
component: AgreementComponent
},
{
path: 'smspage',
component: SmsPagePage
}
]
}
@ -60,6 +65,7 @@ const routes: Routes = [
LoginComponent,
ForgotComponent,
AgreementComponent,
SmsPagePage
],
providers:[
FingerprintAIO,

@ -1,9 +1,11 @@
<ion-header>
<nav-buttons ></nav-buttons>
<ion-toolbar>
<nav-buttons ></nav-buttons>
<ion-title>{{'login,forgot-password' | translate}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<ion-grid>

@ -58,8 +58,8 @@ export class ForgotComponent implements OnInit,OnDestroy {
private sendSMSForForgotPassword() {
const request = new CheckUserAuthenticationRequest();
request.PatientMobileNumber = this.countryCode.number;
request.ZipCode = CountryCode.localCode(this.countryCode.code);
//request.PatientMobileNumber = this.countryCode.number;
//request.ZipCode = CountryCode.localCode(this.countryCode.code);
this.authService.sendSMSForForgotFileNumber(
request,

@ -16,18 +16,18 @@
<ion-item>
<img class="item-icon" src="assets/imgs/username.png" item-start />
<ion-label>{{ts.trPK('login','username')}}</ion-label>
<ion-input required type="text" [(ngModel)]="memberLogin.P_USER_NAME">
<ion-input required type="text" [(ngModel)]="username">
</ion-input>
</ion-item>
<ion-item>
<img class="item-icon" src="assets/imgs/password.png" item-start />
<ion-label>{{ts.trPK('login','password')}}</ion-label>
<ion-input required type="password" [(ngModel)]="memberLogin.P_PASSWORD">
<ion-input required type="password" [(ngModel)]="password">
</ion-input>
</ion-item>
<div class="centerDiv signupDiv" *ngIf="isAppleStore==true">
<div class="centerDiv signupDiv" *ngIf="isAppleStore==false">
<a (click)="signUp()">{{ts.trPK('login','signup')}}</a>
</div>
<div class="gridDiv">
@ -38,7 +38,7 @@
</ion-content>
<ion-footer>
<div class="centerDiv">
<ion-button color="customnavy" (click)="http_call()">{{ts.trPK('login','login')}}</ion-button>
<ion-button color="customnavy" (click)="onLogin()">{{ts.trPK('login','login')}}</ion-button>
</div>
<br/>
<div class="centerDiv">

@ -31,6 +31,11 @@ export class LoginComponent implements OnInit, OnDestroy {
isSupportAr:boolean=false;
isAppleStore:boolean=false;
memberLogin: any = {};
private password: string;
private language: string;
private username : string;
constructor(
public cs: CommonService,
public authService: AuthenticationService,
@ -58,6 +63,14 @@ export class LoginComponent implements OnInit, OnDestroy {
}
public changeLanguage(){
this.ts.switchLanguage();
console.log(this.ts.getCurrentSystemLanguageName());
if(TranslatorService.CURRENT_LANGUAGE == TranslatorService.EN)
{
this.language = "US";
}
else{
this.language = "AR";
}
}
private checkIfLoggedInBefore() {
this.cs.startLoading();
@ -135,10 +148,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);
});
}
@ -157,16 +170,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();
}
@ -344,17 +348,17 @@ 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;
console.log(request);
this.authService.checkUserAuthentication(
request,
() => {
}, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => {
if (this.cs.validResponse(result)) {
console.log(result);
this.cs.openSMSPage();
this.loginTokenID = result.LogInTokenID;
this.patientOutSA = result.PatientOutSA;
this.isMobileFingerPrint = false;
@ -399,7 +403,7 @@ export class LoginComponent implements OnInit, OnDestroy {
private FingerPrintPatientIdentificationID: string;
private checkActivationCode(readedCode?) {
const request = new CheckActivationCodeRequest();
/*const request = new CheckActivationCodeRequest();
request.IsMobileFingerPrint = this.isMobileFingerPrint;
request.FingerPrintPatientIdentificationID = this.FingerPrintPatientIdentificationID;
request.LogInTokenID = this.loginTokenID;
@ -408,6 +412,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;
@ -416,7 +422,6 @@ export class LoginComponent implements OnInit, OnDestroy {
// request.PatientID = Number(this.id);
// request.PatientIdentificationID = '';
// }
request.isRegister = false;
// this.authService.checkActivationCode(
// request,
// () => {
@ -440,7 +445,7 @@ export class LoginComponent implements OnInit, OnDestroy {
if (this.authService.isAgreedBefore()) {
this.cs.openHome();
} else {
this.cs.openAgreement();
//this.cs.openAgreement();
}
});
}

@ -0,0 +1,26 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { SmsPagePage } from './sms-page.page';
const routes: Routes = [
{
path: 'smspage',
component: SmsPagePage
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
declarations: [SmsPagePage]
})
export class SmsPagePageModule {}

@ -0,0 +1,36 @@
<ion-header>
<ion-toolbar>
<ion-title>{{'verificationcode.verificationcode' | translate}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<ion-grid>
<ion-row>
<ion-col class="colPad">
<ion-img class="centerDiv" src="../assets/imgs/CS.png"></ion-img>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<p class="centerDiv">{{'verificationcode.title' | translate}}<span class="boldTxtNav">{{'verificationcode.verificationcode' | translate}}</span> {{'verificationcode.by' | translate}}<span class="boldTxtNav">{{'verificationcode.sms' | translate}}</span>{{'verificationcode.instruct' | translate}}<span class="boldTxtNav">{{'general.submit' | translate}}</span></p>
</ion-col>
</ion-row>
</ion-grid>
<br/><br/>
<!-- <p style="color: #c0c0c0; margin-left: 32%">{{'verificationcode.verificationcode' | translate}}</p> -->
<div>
<h1 text-center>{{displayTime}}</h1>
<br/><br/>
<ion-item>
<ion-label>{{'verificationcode.verificationcode' | translate}}</ion-label>
<!-- <img class="item-icon" src="assets/imgs/password.png" item-start /> -->
<ion-input required type="tel" [(ngModel)]="activationCode"></ion-input>
</ion-item>
</div>
</ion-content>
<ion-footer>
<div class="centerDiv">
<button ion-button (click)="checkVerificationCode()">{{'general.submit' | translate}}</button>
</div>
</ion-footer>

@ -0,0 +1,27 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SmsPagePage } from './sms-page.page';
describe('SmsPagePage', () => {
let component: SmsPagePage;
let fixture: ComponentFixture<SmsPagePage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SmsPagePage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SmsPagePage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,38 @@
import { Component, OnInit } 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';
@Component({
selector: 'app-sms-page',
templateUrl: './sms-page.page.html',
styleUrls: ['./sms-page.page.scss'],
})
export class SmsPagePage implements OnInit {
Channel: number=0;
activationCode: string;
P_SESSION_ID: number;
timeInSeconds: 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;
constructor(public navCtrl: NavController,
public translate: TranslatorService,
public common:CommonService,
private elementRef:ElementRef,
public sharedData:SharedDataService) { }
ngOnInit() {
}
}

@ -36,6 +36,9 @@ export class AuthenticationService {
/* 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';
@ -90,12 +93,13 @@ export class AuthenticationService {
}
public setPublicFields(request: Request): Request {
request.VersionID = 3.6;
request.Channel = 3;
request.VersionID = 1;
request.Channel = 31;
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.isDentalAllowedBackend = false;
request.MobileType = "android";
//request.isDentalAllowedBackend = false;
return request;
}
@ -420,7 +424,7 @@ export class AuthenticationService {
public checkUserAuthentication(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.checkUserAuthURL, request, onError, errorLabel);
return this.con.post(AuthenticationService.login, request, onError, errorLabel);
}
public checkActivationCode(request: CheckActivationCodeRequest, onError: any, errorLabel: string)
@ -466,8 +470,8 @@ export class AuthenticationService {
request.TokenID = '';
request.PatientIdentificationID = '';
request.PatientID = 0;
request.SearchType = 2;
request.isRegister = false;
//request.SearchType = 2;
//request.isRegister = false;
return this.con.post(AuthenticationService.sendSMSForgotFileNoURL, request, onError, errorLabel);
}
@ -540,7 +544,7 @@ export class AuthenticationService {
} else {
this.cs.presentConfirmDialog(this.ts.trPK('login', 'enter-email'),
() => {
this.cs.openPatientProfile();
//this.cs.openPatientProfile();
observer.complete();
});
}
@ -564,7 +568,7 @@ export class AuthenticationService {
private sessionTimeOutDialog() {
this.cs.presentConfirmDialog(this.ts.trPK('general', 'idle-relogin'), () => {
this.cs.openUserLogin();
//this.cs.openUserLogin();
});
}

@ -1,10 +1,14 @@
import { Request } from '../../models/request';
export class CheckUserAuthenticationRequest extends Request {
PatientIdentificationID: string; // id
PatientMobileNumber: string; // phone number
ZipCode: string;
SearchType: number; // 1 for id , 2 for file no
isRegister: boolean; // false
LogInTokenID?: string;
// PatientIdentificationID: string; // id
// PatientMobileNumber: string; // phone number
// ZipCode: string;
// SearchType: number; // 1 for id , 2 for file no
// isRegister: boolean; // false
// LogInTokenID?: string;
P_USER_NAME:string;
P_LANGUAGE: string;
P_PASSWORD: string;
}

@ -899,6 +899,9 @@ export class CommonService {
public openUserForgot() {
this.nav.navigateForward(["/authentication/forgot"]);
}
public openSMSPage() {
this.nav.navigateForward(["/authentication/smspage"]);
}
public navigateTo(url: string) {

@ -12,6 +12,7 @@ export class Request {
public IsIrisPrescription: boolean;
public TokenID: string;
public SessionID: string;
public MobileType: string;
public PatientIdentificationID: string;
public PatientMobileNumber: string;
public BookedBy?: number;

@ -1,51 +1,36 @@
<ion-header>
<ion-toolbar>
<ion-title>{{'sms,title' | translate}}</ion-title>
</ion-toolbar>
<ion-toolbar>
<ion-title>{{'verificationcode.verificationcode' | translate}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<ion-grid>
<!-- identification number / file id -->
<ion-row class="ion-justify-content-center">
<img src="assets/icon/verification-code.png" style="width: 25%;height: 35%;" />
</ion-row>
<ion-row class="ion-justify-content-center" >
<ion-text text-center>
<h6>{{ 'home,verification-code-text'| translate}}</h6>
</ion-text>
<ion-text text-center>
<h6>{{mobile}}</h6>
</ion-text>
</ion-row>
<ion-row class="sms_code">
<ion-col [size]="12">
<ion-label class="input-label" >{{ 'h2o,verification_message' | translate}}</ion-label>
<ion-input class="input_bottom" [placeholder]="'h2o,sms_code' | translate" [(ngModel)]="smc_code" pattern="number"></ion-input>
</ion-col>
</ion-row>
<!-- international mobile number-->
<ion-row class="timer-body" >
<ion-col [size]="9">
<ion-label class="input-label" >{{ 'h2o,validation_message' | translate}}</ion-label>
</ion-col>
<ion-col [size]="3">
<ion-label class="input-label-strong" > {{displayTime}} </ion-label>
</ion-col>
<ion-content padding>
<ion-grid>
<ion-row>
<ion-col class="colPad">
<ion-img class="centerDiv" src="../assets/imgs/CS.png"></ion-img>
</ion-col>
</ion-row>
<ion-row *ngIf="resend" >
<ion-col [size]="8" >
<p> {{'h2o,code_failure' | translate}} </p>
</ion-col>
<ion-col [size]="4" class="resend-coloumn" >
<ion-button (click)="ResendOTP()"> {{'h2o,resend' | translate}} </ion-button>
</ion-col>
</ion-row>
<ion-row class="ion-justify-content-center bottom-grid" >
<ion-col [size]="12" >
<ion-button (click)="validate()" expand="full"> {{'general,submit' | translate}} </ion-button>
</ion-col>
<ion-row>
<ion-col>
<p class="centerDiv">{{'verificationcode.title' | translate}}<span class="boldTxtNav">{{'verificationcode.verificationcode' | translate}}</span> {{'verificationcode.by' | translate}}<span class="boldTxtNav">{{'verificationcode.sms' | translate}}</span>{{'verificationcode.instruct' | translate}}<span class="boldTxtNav">{{'general.submit' | translate}}</span></p>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>
</ion-grid>
<br/><br/>
<!-- <p style="color: #c0c0c0; margin-left: 32%">{{'verificationcode.verificationcode' | translate}}</p> -->
<div>
<h1 text-center>{{displayTime}}</h1>
<br/><br/>
<ion-item>
<ion-label>{{'verificationcode.verificationcode' | translate}}</ion-label>
<!-- <img class="item-icon" src="assets/imgs/password.png" item-start /> -->
<ion-input required type="tel" [(ngModel)]="activationCode"></ion-input>
</ion-item>
</div>
</ion-content>
<ion-footer>
<div class="centerDiv">
<button ion-button (click)="checkVerificationCode()">{{'general.submit' | translate}}</button>
</div>
</ion-footer>
Loading…
Cancel
Save