opt and email space issue fix
This commit is contained in:
parent
f405d492f4
commit
55a887c415
@ -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,
|
||||
|
||||
@ -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: `
|
||||
// <h5 class="mt-0">New Password Change.</h5>
|
||||
@Component({
|
||||
selector: 'app-jazz-dialog',
|
||||
template: `
|
||||
<h5 class="mt-0">New Password Change.</h5>
|
||||
|
||||
// <mat-form-field>
|
||||
// <input matInput placeholder="New Password" #newpassword type="password" style="width: 100%;">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="New Password" #newpassword type="password" style="width: 100%;">
|
||||
|
||||
// </mat-form-field>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
// <br/>
|
||||
// <mat-form-field>
|
||||
// <input matInput placeholder="ConfirmPassword" #confirmPassword type="password" style="width: 100%;">
|
||||
// </mat-form-field>
|
||||
<br/>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="ConfirmPassword" #confirmPassword type="password" style="width: 100%;">
|
||||
</mat-form-field>
|
||||
|
||||
// <small *ngIf="confirmPassword.value !='' && newpassword.value != confirmPassword.value" class="mat-text-warn">Passwords do not math.</small>
|
||||
<small *ngIf="confirmPassword.value !='' && newpassword.value != confirmPassword.value" class="mat-text-warn">Passwords do not math.</small>
|
||||
|
||||
// <br>
|
||||
<br>
|
||||
|
||||
// <button mat-raised-button class="mat-green" type="submit" (click)="dialogRef.close(newpassword.value)">Submit</button>
|
||||
<button mat-raised-button class="mat-green" type="submit" (click)="dialogRef.close(newpassword.value)">Submit</button>
|
||||
|
||||
|
||||
// `
|
||||
// })
|
||||
// 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<NewPasswordDialog>) {
|
||||
constructor(public dialogRef: MatDialogRef<NewPasswordDialog>) {
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @Component({
|
||||
// selector: 'app-jazz-dialog',
|
||||
// template: `
|
||||
// <h5 class="mt-0">Forgot Password</h5>
|
||||
@Component({
|
||||
selector: 'app-jazz-dialog',
|
||||
template: `
|
||||
<h5 class="mt-0">Forgot Password</h5>
|
||||
|
||||
// <mat-form-field>
|
||||
// <input matInput placeholder="Email Id" #newpassword type="Email" style="width: 100%;">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Email Id" #newpassword type="Email" style="width: 100%;">
|
||||
|
||||
// </mat-form-field>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
|
||||
// <br>
|
||||
<br>
|
||||
|
||||
// <button mat-raised-button class="mat-green" type="submit" (click)="dialogRef.close(newpassword.value)">Submit</button>
|
||||
<button mat-raised-button class="mat-green" type="submit" (click)="dialogRef.close(newpassword.value)">Submit</button>
|
||||
|
||||
|
||||
// `
|
||||
// })
|
||||
// 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<ForgotPass>) {
|
||||
constructor(public dialogRef: MatDialogRef<ForgotPass>) {
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
38
src/pages/otp/otp.html
Normal file
38
src/pages/otp/otp.html
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
|
||||
<!--
|
||||
Generated template for the AdvanceFilterPage page.
|
||||
|
||||
See http://ionicframework.com/docs/components/#navigation for more info on
|
||||
Ionic pages and navigation.
|
||||
-->
|
||||
<ion-header>
|
||||
|
||||
<ion-navbar>
|
||||
<ion-title >OTP</ion-title>
|
||||
<ion-buttons end>
|
||||
<button ion-button clear (click)="closeModal()"><ion-icon name="close" style="font-size: 20px;"></ion-icon></button>
|
||||
</ion-buttons>
|
||||
</ion-navbar>
|
||||
|
||||
</ion-header>
|
||||
|
||||
|
||||
<ion-content padding>
|
||||
|
||||
<mat-form-field style="width: 80%">
|
||||
<input matInput placeholder="Enter OTP" #otp
|
||||
type="text" maxlength="6">
|
||||
</mat-form-field>
|
||||
</ion-content>
|
||||
<ion-footer>
|
||||
<div align="right" fxLayout="row" fxLayoutAlign="flex-end" style="margin-top: 10px;margin-right: 10px;">
|
||||
|
||||
<!-- <button mat-raised-button mat-icon-button (click)="updatepassword(otp.value)" class="mr-1 mb-1 hover-icon" type="button" matTooltip="Update Password" matTooltipPosition="below"><mat-icon>save</mat-icon></button> -->
|
||||
|
||||
<!-- <button style="background-color: #e2412f;" mat-raised-button mat-icon-button (click)="updatepassword(otp.value)" class="mr-1 mt-1 hover-icon">
|
||||
<ion-icon name="save"></ion-icon>
|
||||
</button> -->
|
||||
<button class="btn-no-pad" medium ion-button round color="optblue" (click)="updatepassword(otp.value)"><ion-icon style="color:gray;font-size: 24px;" name="md-arrow-dropright-circle"></ion-icon> </button>
|
||||
</div>
|
||||
</ion-footer>
|
||||
13
src/pages/otp/otp.module.ts
Normal file
13
src/pages/otp/otp.module.ts
Normal file
@ -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 {}
|
||||
25
src/pages/otp/otp.scss
Normal file
25
src/pages/otp/otp.scss
Normal file
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
56
src/pages/otp/otp.ts
Normal file
56
src/pages/otp/otp.ts
Normal file
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@ -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';
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -155,7 +155,20 @@ apiurl:any;
|
||||
});
|
||||
}
|
||||
|
||||
generateotp(email): Observable<any> {
|
||||
|
||||
return this.http.post(this.apiurl.url + 'generateOTP', { "records":{ "email":email}})
|
||||
// .pipe(
|
||||
// catchError(this.handleError('role', []))
|
||||
// )
|
||||
}
|
||||
resetpassword(data,otp): Observable<any> {
|
||||
|
||||
return this.http.post(this.apiurl.url + 'verifyOTP', { "records":{ "email":data,"OTP":otp}})
|
||||
// .pipe(
|
||||
// catchError(this.handleError('role', []))
|
||||
// )
|
||||
}
|
||||
/**
|
||||
* Config function
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user