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-col text-center>
<h4>PIN</h4>
<span style="color: red;">Should be 4 digit</span>
</ion-col>
</ion-row>
<ion-row>
<ion-col text-center>
<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>
<br/>
<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>
</ion-col>
@ -37,7 +42,10 @@
</mat-card-content>
<mat-card-footer>
<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-footer>
@ -61,10 +69,15 @@
<ion-row>
<ion-col text-center>
<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>
</ion-col>
</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-footer>
<mat-card-actions text-center>

View File

@ -5,7 +5,7 @@ page-auth {
.mat-card{
width: 80%;
margin-left: 10%;
margin-top: 35%;
margin-top: 15%;
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;
}
@ -33,5 +33,7 @@ page-auth {
ion-icon{
font-size:2.2em;
}
input.mat-input-element {
-webkit-text-security: disc;
}
}

View File

@ -32,6 +32,7 @@ pin:any;
mpinaccess:boolean =false;
newpassword: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) {
let pinLockImage = localStorage.getItem('pinLockImage')
@ -93,9 +94,31 @@ pin:any;
//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;
if(this.newpindetails.dataStatus == true)
@ -108,6 +131,12 @@ pin:any;
// else{
// 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])
if(role == 'sales'){
this.navCtrl.setRoot(SalesPDlistPage);
@ -115,6 +144,7 @@ pin:any;
else{
this.navCtrl.setRoot(PdListPage,{'userDetails':this.userDetails});
}
}
// this.navCtrl.setRoot(PdListPage);
}
})

View File

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