Fairoj : pin reset feature introduced with related validation are added

This commit is contained in:
venbatechnologies@gmail.com 2020-11-18 16:19:26 +05:30
parent 93b2911394
commit cc393c02a1
4 changed files with 36 additions and 7 deletions

View File

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<widget id="com.sineedge.pdgvendor" version="0.0.4" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <widget id="com.sineedge.pdgvendor" version="0.0.5" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>PD Genie Field Visit</name> <name>PD Genie Field Visit</name>
<description>info@pdgenie.com</description> <description>info@pdgenie.com</description>
<author email="info@pdgenie.com" href="https://pdgenie.com">PD Genie</author> <author email="info@pdgenie.com" href="https://pdgenie.com">PD Genie</author>

View File

@ -16,16 +16,17 @@
<ion-row> <ion-row>
<ion-col class="ion-text-center"> <ion-col class="ion-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 class="ion-text-center"> <ion-col class="ion-text-center">
<mat-form-field> <mat-form-field>
<input matInput type="password" placeholder="New PIN" #newpassword pattern="[0-9]{4}" maxlength="4" style="width: 100%;" required> <input matInput type="password" 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 type="ext-centerpassword" placeholder="Confirm PIN" #confirmPassword pattern="[0-9]{4}" maxlength="4" style="width: 100%;" required <input matInput type="ext-centerpassword" placeholder="Confirm PIN" #confirmPassword pattern="[0-9]{4}" maxlength="4" style="width: 100%;" required
@ -36,7 +37,7 @@
</mat-card-content> </mat-card-content>
<mat-card-footer> <mat-card-footer>
<mat-card-actions class="ion-text-center"> <mat-card-actions class="ion-text-center">
<button mat-raised-button color="primary" (click)="setnewpin(newpassword.value)">UNLOCK</button> <button mat-raised-button color="primary" (click)="setnewpin(newpassword,confirmPassword)">UNLOCK</button>
</mat-card-actions> </mat-card-actions>
</mat-card-footer> </mat-card-footer>
@ -63,6 +64,9 @@
</mat-form-field> </mat-form-field>
</ion-col> </ion-col>
</ion-row> </ion-row>
<ion-row class="ion-float-right">
<button class="ion-float-right" mat-button style="color: blue;font-style:italic;text-decoration: underline;" (click)="resetPin()">Forgot Pin</button>
</ion-row><br/><br/>
</mat-card-content> </mat-card-content>
<mat-card-footer> <mat-card-footer>
<mat-card-actions class="ion-text-center"> <mat-card-actions class="ion-text-center">

View File

@ -5,7 +5,7 @@
.mat-card{ .mat-card{
width: 80%; width: 80%;
margin-left: 10%; margin-left: 10%;
margin-top: 35%; margin-top: 33%;
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;
} }

View File

@ -83,16 +83,41 @@ pin:any;
this.loadingCtrl.dismissLoader(); this.loadingCtrl.dismissLoader();
}); });
} }
setnewpin(newpin) resetPin() {
this.mpinaccess = true
}
setnewpin(newpin,confirmPin)
{ {
console.log("set Pin") console.log("set Pin",newpin,newpin.checkValidity(),newpin.value,newpin.validationMessage)
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 != confirmPin.value) {
this.toast.pdTriggerappmessage("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)
{ {
if(this.userDetails[0].mpin == null) {
this.navCtrl.navigateRoot('/pd'); this.navCtrl.navigateRoot('/pd');
} }
else{
this.toast.pdTriggerappmessage("Pin Reset Successfully")
this.userDetails[0].mpin = newpin.value
this.mpinaccess = false
}
}
else{
this.toast.pdTriggerappmessage("Something went wrong")
}
},err=>{
this.toast.pdTriggerappmessage("Network Error!!")
}) })
} }
/**Finger print */ /**Finger print */