diff --git a/src/app/app.module.ts b/src/app/app.module.ts index f663190..160bd7c 100755 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -95,6 +95,7 @@ import {SocialSharing} from '@ionic-native/social-sharing' import { CreditSectionListPageModule } from '../pages/credit_pd/pages/credit-section-list/credit-section-list.module'; import { OfflineManagerCreditProvider } from '../pages/credit_pd/providers/offline-manager-credit/offline-manager-credit'; import { ApiServiceProvider } from '../pages/credit_pd/providers/api-service/api-service'; +import { OtpPage } from '../pages/otp/otp'; // need the hammerConnfig export class HammerConfig extends HammerGestureConfig { @@ -118,6 +119,7 @@ export class HammerConfig extends HammerGestureConfig { AuthPage, LoginPage, PdListPage, + OtpPage, PasswordPage, PdAllocationPage, @@ -177,6 +179,7 @@ export class HammerConfig extends HammerGestureConfig { AuthPage, LoginPage, PdListPage, + OtpPage, PasswordPage, PdAllocationPage, diff --git a/src/pages/login/login.ts b/src/pages/login/login.ts index 639504c..765f0f5 100755 --- a/src/pages/login/login.ts +++ b/src/pages/login/login.ts @@ -1,5 +1,5 @@ import { Component,OnInit, ViewEncapsulation } from '@angular/core'; -import { IonicPage, NavController, NavParams, MenuController,LoadingController, Events } from 'ionic-angular'; +import { IonicPage, NavController, NavParams, MenuController,LoadingController, Events, ModalController, ModalOptions } from 'ionic-angular'; import { AlertController } from 'ionic-angular'; // import {Validators, FormBuilder, FormGroup } from '@angular/forms'; // import { GridPage } from '../grid/grid'; @@ -13,7 +13,7 @@ import { AwsServiceProvider } from '../../providers/aws-service/aws-service'; import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms'; // import { CustomValidators } from 'ng2-validation'; -import { MatDialog, MatDialogRef, MatDialogConfig } from '@angular/material'; +import { MatDialogConfig, MatDialogRef } from '@angular/material'; import { CognitoServiceProvider } from '../../providers/aws-service/cognito.service'; import { PdListPage } from '../pd-list/pd-list'; import { PasswordPage } from '../password/password'; @@ -23,6 +23,7 @@ import { SalesPDlistPage } from '../sales_pd/pages/sales-p-dlist/sales-p-dlist'; import { PdtriggerProvider } from '../../providers/pdtrigger/pdtrigger'; import { SalesPdProvider } from '../sales_pd/providers/sales-pd/sales-pd'; import { AuthPage } from '../auth/auth'; +import { OtpPage } from '../otp/otp'; @Component({ @@ -40,7 +41,7 @@ changePassword: any; status: Boolean = false; config: MatDialogConfig = { disableClose: false, - width: '', + width: '10px', height: '', position: { top: '', @@ -51,8 +52,8 @@ config: MatDialogConfig = { }; userDetails: any; commonDetails: any; - forgetpin: boolean = false; -constructor( public aws: AwsServiceProvider, public dialog: MatDialog, public navParams: NavParams, + forgetpin: boolean = false; +constructor(private modalCtrl:ModalController,public aws: AwsServiceProvider, public navParams: NavParams, public shared:CognitoServiceProvider,public navCtrl:NavController,public Menu:MenuController ,public toast:ToastProvider,public load:LoadingController,private events:Events,private constantProvider:ConstantsProvider,private pdtrigger:PdtriggerProvider,private salesPDProvider:SalesPdProvider) { @@ -84,7 +85,9 @@ login() { if(this.email !==undefined && this.password !==undefined && this.email !='' && this.password !='' && this.email !=null && this.password !=null ){ - let auth = { 'Username': this.email, 'Password': this.password }; + const mailid = this.email.split(/\s/).join(''); + const password = this.password.split(/\s/).join(''); + let auth = { 'Username': mailid, 'Password': password }; this.aws.dologin(auth).subscribe(awsres => { this.presentLoading() @@ -189,13 +192,39 @@ forgotopen() { } -forgotpassword() { - // alert('rets'); - let auth = { 'Username': this.email }; - console.log(auth); - this.aws.userforgotpass(auth).subscribe(res => { - +// forgotpassword() { +// // alert('rets'); +// // let auth = { 'Username': this.email }; +// // console.log(auth); +// this.aws.generateotp(this.email).subscribe(res => { + +// if(res.status == 200) { +// this.dialogRef = this.dialog.open(OtpPage, { +// data: this.email, +// width: '30%', +// disableClose: true +// }); + +// } + + +// // }) +// } +forgotpassword(){ + this.aws.generateotp(this.email).subscribe(res => { + if(res.status == 200) { + const modalOption:ModalOptions={ + cssClass:'filterModal' + } + const modalCtrl=this.modalCtrl.create(OtpPage,{'drop_down_datas':this.email}) + modalCtrl.present(); + modalCtrl.onDidDismiss((data)=>{ + console.log(data) + }) + }else{ + alert(res.msg); + } }) } loggedInCheck(){ @@ -218,76 +247,76 @@ loggedInCheck(){ * New password Dialog */ -// const newpassword = new FormControl('', Validators.required); -// const confirmPassword = new FormControl(''); +const newpassword = new FormControl('', Validators.required); +const confirmPassword = new FormControl(''); -// @Component({ -// selector: 'app-jazz-dialog', -// template: ` -//
New Password Change.
+@Component({ +selector: 'app-jazz-dialog', +template: ` +
New Password Change.
-// -// + + -// + -//
-// -// -// +
+ + + -// Passwords do not math. +Passwords do not math. -//
+
-// + -// ` -// }) -// export class NewPasswordDialog { + ` +}) +export class NewPasswordDialog { -// newpassword: any = newpassword; -// confirmPassword: any = confirmPassword; -// jazzMessage = 'Jazzy jazz jazz'; +newpassword: any = newpassword; +confirmPassword: any = confirmPassword; +jazzMessage = 'Jazzy jazz jazz'; -// constructor(public dialogRef: MatDialogRef) { +constructor(public dialogRef: MatDialogRef) { -// } +} -// } +} -// @Component({ -// selector: 'app-jazz-dialog', -// template: ` -//
Forgot Password
+@Component({ +selector: 'app-jazz-dialog', +template: ` +
Forgot Password
-// -// + + -// + -//
+
-// + -// ` -// }) -// export class ForgotPass { + ` +}) +export class ForgotPass { -// newpassword: any = newpassword; -// confirmPassword: any = confirmPassword; -// jazzMessage = 'Jazzy jazz jazz'; +newpassword: any = newpassword; +confirmPassword: any = confirmPassword; +jazzMessage = 'Jazzy jazz jazz'; -// constructor(public dialogRef: MatDialogRef) { +constructor(public dialogRef: MatDialogRef) { -// } +} -// } + } diff --git a/src/pages/otp/otp.html b/src/pages/otp/otp.html new file mode 100644 index 0000000..495e90c --- /dev/null +++ b/src/pages/otp/otp.html @@ -0,0 +1,38 @@ + + + + + + + OTP + + + + + + + + + + + + + + + +
+ + + + + +
+
diff --git a/src/pages/otp/otp.module.ts b/src/pages/otp/otp.module.ts new file mode 100644 index 0000000..265c9e2 --- /dev/null +++ b/src/pages/otp/otp.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from '@angular/core'; +import { IonicPageModule } from 'ionic-angular'; +import { OtpPage } from './otp'; + +@NgModule({ + declarations: [ + OtpPage, + ], + imports: [ + IonicPageModule.forChild(OtpPage), + ], +}) +export class OtpPageModule {} diff --git a/src/pages/otp/otp.scss b/src/pages/otp/otp.scss new file mode 100644 index 0000000..dfb04bf --- /dev/null +++ b/src/pages/otp/otp.scss @@ -0,0 +1,25 @@ +page-otp { + mat-form-field { + margin: 0 2%; + } + .paragraph_change { + color: #fff !important; + background-color: #e00201 !important; + // padding: 10px !important; + } + .cdk-global-overlay-wrapper{ + justify-content: center !important; + } + mat-dialog-actions{ + border-top: 2px solid #e00201; + } + + .mat-form-field-appearance-legacy .mat-hint{ + color:rgba(0, 0, 0, 0.8) !important; + } + .my-modal { + height: 50%!important; + width: 50%!important; + } + +} diff --git a/src/pages/otp/otp.ts b/src/pages/otp/otp.ts new file mode 100644 index 0000000..3376882 --- /dev/null +++ b/src/pages/otp/otp.ts @@ -0,0 +1,56 @@ +import { Component, Inject, Input } from '@angular/core'; +import { IonicPage, NavController, NavParams, ViewController } from 'ionic-angular'; +import { AwsServiceProvider } from '../../providers/aws-service/aws-service'; +import { MAT_DIALOG_DATA } from '@angular/material'; +import { ToastProvider } from '../../providers/common-provider/toast'; + +/** + * Generated class for the OtpPage page. + * + * See https://ionicframework.com/docs/components/#navigation for more info on + * Ionic pages and navigation. + */ + +@IonicPage() +@Component({ + selector: 'page-otp', + templateUrl: 'otp.html', +}) +export class OtpPage { + @Input()drop_down_datas + + constructor(private viewCtrl:ViewController,public toast:ToastProvider,public navCtrl: NavController, public navParams: NavParams,public aws: AwsServiceProvider) { + } + ngOnInit() { + this.drop_down_datas = this.navParams.get('drop_down_datas'); + console.log(this.drop_down_datas); + } + updatepassword(otp) + { + console.log('data'); + console.log(this.drop_down_datas,otp); + this.aws.resetpassword(this.drop_down_datas,otp).subscribe(data => { + console.log('data'); + console.log(data) + if (data.status == 200) { + this.toast.lenderappmessage('Password Reset Successfully'); + // alert('Password Reset Successfully'); + // this.dialogRef.close(); + this.viewCtrl.dismiss(); + } else + { + alert('OTP is invalid. Plesae enter correct OTP.!'); + + } + + }) +} + ionViewDidLoad() { + console.log('ionViewDidLoad OtpPage'); + } + + closeModal() { + this.viewCtrl.dismiss(); +} + +} diff --git a/src/pages/sales_pd/pages/sales-p-dlist/sales-p-dlist.ts b/src/pages/sales_pd/pages/sales-p-dlist/sales-p-dlist.ts index 0f34760..43944ed 100755 --- a/src/pages/sales_pd/pages/sales-p-dlist/sales-p-dlist.ts +++ b/src/pages/sales_pd/pages/sales-p-dlist/sales-p-dlist.ts @@ -15,7 +15,6 @@ import { SectionListPageModule } from '../section-list/section-list.module'; import { CreditSectionListPageModule } from '../../../credit_pd/pages/credit-section-list/credit-section-list.module'; import { CreditSectionListPage } from '../../../credit_pd/pages/credit-section-list/credit-section-list'; import { ApiServiceProvider } from '../../../credit_pd/providers/api-service/api-service'; -import { BrowserTab } from '@ionic-native/browser-tab'; /** diff --git a/src/providers/aws-service/aws-service.ts b/src/providers/aws-service/aws-service.ts index 157ca84..79c1c74 100755 --- a/src/providers/aws-service/aws-service.ts +++ b/src/providers/aws-service/aws-service.ts @@ -155,7 +155,20 @@ apiurl:any; }); } + generateotp(email): Observable { + + return this.http.post(this.apiurl.url + 'generateOTP', { "records":{ "email":email}}) + // .pipe( + // catchError(this.handleError('role', [])) + // ) + } + resetpassword(data,otp): Observable { + return this.http.post(this.apiurl.url + 'verifyOTP', { "records":{ "email":data,"OTP":otp}}) + // .pipe( + // catchError(this.handleError('role', [])) + // ) + } /** * Config function */