Pin Reset option introduced

This commit is contained in:
venbatechnologies@gmail.com 2020-12-16 11:52:05 +05:30
parent 62d8cdf9aa
commit ee79907fba
4 changed files with 62 additions and 8 deletions

View File

@ -17,19 +17,24 @@
<ion-row> <ion-row>
<ion-col text-center> <ion-col text-center>
<h4>PIN</h4> <h4>PIN</h4>
<span style="color: red;">Should be 4 digit</span>
</ion-col> </ion-col>
</ion-row> </ion-row>
<ion-row> <ion-row>
<ion-col text-center> <ion-col text-center>
<mat-form-field> <mat-form-field>
<input matInput placeholder="New PIN" #newpassword pattern="[0-9]{4}" maxlength="4" style="width: 100%;" required> <input type="number"
oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"
matInput placeholder="New PIN" #newpassword pattern="[0-9]{4}" maxlength="4" style="width: 100%;" required>
</mat-form-field> </mat-form-field>
<br/> <br/>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Confirm PIN" #confirmPassword pattern="[0-9]{4}" maxlength="4" style="width: 100%;" required <input type="number"
oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"
matInput placeholder="Confirm PIN" #confirmPassword pattern="[0-9]{4}" maxlength="4" style="width: 100%;" required
> >
</mat-form-field> </mat-form-field>
</ion-col> </ion-col>
@ -37,7 +42,10 @@
</mat-card-content> </mat-card-content>
<mat-card-footer> <mat-card-footer>
<mat-card-actions text-center> <mat-card-actions text-center>
<button mat-raised-button color="primary" (click)="setnewpin(newpassword.value)">UNLOCK</button> <button mat-raised-button color="primary" (click)="setnewpin(newpassword,confirmPassword)">Submit</button>
<ion-row style="justify-content: flex-end;" *ngIf="isPinReset">
<button mat-button style="color: blue;font-style:italic;text-decoration: underline;" (click)="goBack()">Back</button>
</ion-row>
</mat-card-actions> </mat-card-actions>
</mat-card-footer> </mat-card-footer>
@ -61,10 +69,15 @@
<ion-row> <ion-row>
<ion-col text-center> <ion-col text-center>
<mat-form-field> <mat-form-field>
<input matInput type="password" placeholder="PIN" #pin pattern="[0-9]{4}" maxlength="4" style="width: 100%;" required> <input matInput type="number"
oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"
style="-webkit-text-security:disc;" placeholder="PIN" #pin pattern="[0-9]{4}" maxlength="4" style="width: 100%;" required>
</mat-form-field> </mat-form-field>
</ion-col> </ion-col>
</ion-row> </ion-row>
<ion-row style="justify-content: flex-end;">
<button mat-button style="color: blue;font-style:italic;text-decoration: underline;" (click)="resetPin()">Forgot Pin</button>
</ion-row>
</mat-card-content> </mat-card-content>
<mat-card-footer> <mat-card-footer>
<mat-card-actions text-center> <mat-card-actions text-center>

View File

@ -5,7 +5,7 @@ page-auth {
.mat-card{ .mat-card{
width: 80%; width: 80%;
margin-left: 10%; margin-left: 10%;
margin-top: 35%; margin-top: 15%;
border-radius: 10px; border-radius: 10px;
box-shadow: 0 16px 38px -12px rgba(0,0,0,.56), 0 4px 25px 0 rgba(0,0,0,.12), 0 8px 10px -5px rgba(0,0,0,.2) !important; box-shadow: 0 16px 38px -12px rgba(0,0,0,.56), 0 4px 25px 0 rgba(0,0,0,.12), 0 8px 10px -5px rgba(0,0,0,.2) !important;
} }
@ -33,5 +33,7 @@ page-auth {
ion-icon{ ion-icon{
font-size:2.2em; font-size:2.2em;
} }
input.mat-input-element {
-webkit-text-security: disc;
}
} }

View File

@ -32,6 +32,7 @@ pin:any;
mpinaccess:boolean =false; mpinaccess:boolean =false;
newpassword:any; newpassword:any;
ConfirmPassword:any; ConfirmPassword:any;
isPinReset: boolean;
constructor(public navCtrl: NavController, public navParams: NavParams,public Menu:MenuController,public fb:FormBuilder,public shared:CognitoServiceProvider,public toast:ToastProvider,public faio:FingerprintAIO,public aws:AwsServiceProvider,public loadingCtrl:LoadingProvider,public commonconstant:ConstantsProvider) { constructor(public navCtrl: NavController, public navParams: NavParams,public Menu:MenuController,public fb:FormBuilder,public shared:CognitoServiceProvider,public toast:ToastProvider,public faio:FingerprintAIO,public aws:AwsServiceProvider,public loadingCtrl:LoadingProvider,public commonconstant:ConstantsProvider) {
let pinLockImage = localStorage.getItem('pinLockImage') let pinLockImage = localStorage.getItem('pinLockImage')
@ -93,9 +94,31 @@ pin:any;
//console.log(this.mpinaccess); //console.log(this.mpinaccess);
}); });
} }
setnewpin(newpin) resetPin() {
this.isPinReset = true
this.mpinaccess = true
}
goBack() {
this.isPinReset = false
this.mpinaccess = false
}
setnewpin(newpin,confirmPin)
{ {
this.aws.userpinupdate(newpin).subscribe(res=> if(!newpin.checkValidity()) {
alert(newpin.validationMessage)
return;
}
// let confirmPin:any = document.getElementById('confirmPassword')
console.log(confirmPin)
if(newpin.value.toString().length < 4) {
this.toast.lenderappmessage("Pin must be 4 digit");
return;
}
if(newpin.value != confirmPin.value) {
this.toast.lenderappmessage("Confirm Pin does not match.")
return;
}
this.aws.userpinupdate(newpin.value).subscribe(res=>
{ {
this.newpindetails = res; this.newpindetails = res;
if(this.newpindetails.dataStatus == true) if(this.newpindetails.dataStatus == true)
@ -108,12 +131,19 @@ pin:any;
// else{ // else{
// this.navCtrl.setRoot(PdListPage,{'userDetails':this.userDetails}); // this.navCtrl.setRoot(PdListPage,{'userDetails':this.userDetails});
// } // }
if(this.userDetails[0].mpin != null) {
this.toast.lenderappmessage("Pin Reset Successfully")
this.userDetails[0].mpin = newpin.value
this.mpinaccess = false
}
else{
let role=this.commonconstant.takeDecisionRouting(this.userDetails[0]) let role=this.commonconstant.takeDecisionRouting(this.userDetails[0])
if(role == 'sales'){ if(role == 'sales'){
this.navCtrl.setRoot(SalesPDlistPage); this.navCtrl.setRoot(SalesPDlistPage);
} }
else{ else{
this.navCtrl.setRoot(PdListPage,{'userDetails':this.userDetails}); this.navCtrl.setRoot(PdListPage,{'userDetails':this.userDetails});
}
} }
// this.navCtrl.setRoot(PdListPage); // this.navCtrl.setRoot(PdListPage);
} }

View File

@ -259,6 +259,15 @@ export class SalesPDlistPage {
let actionSheet = this.actionSheetCtrl.create({ let actionSheet = this.actionSheetCtrl.create({
title: 'Select Option', title: 'Select Option',
buttons: [ buttons: [
// {
// text: 'Edit Data',
// icon:'edit',
// role: 'destructive1',
// handler: () => {
// this.editForm(value_obj)
// // console.log('pdf check',this.salesPDpdf);
// }
// },
{ {
text: 'View Report', text: 'View Report',
icon:'eye', icon:'eye',