Correct PIN processing

This commit is contained in:
Rene Vergara 2022-05-20 09:47:17 -05:00
parent d6f48a8338
commit 55ee54cd4f
Signed by: pitmutt
GPG Key ID: 65122AD495A7F5B2
2 changed files with 9 additions and 11 deletions

View File

@ -194,12 +194,8 @@ export class LoginComponent implements OnInit, AfterViewInit {
}
confirmPin(){
if (this.user.pin === this.pinForm.value.pinValue) {
this.userService.validateUser();
this.router.navigate(['/shop']);
} else {
this.pinError = true;
}
this.userService.validateUser(this.pinForm.value.pinValue);
this.loginCheck();
}
ngOnDestroy(){

View File

@ -122,12 +122,14 @@ export class UserService{
}
}
validateUser(){
var validatedUser: User = this.dataStore.user;
validatedUser.validated = true;
this.http.post<{message: string, user: User}>(this.beUrl+'api/validateuser', {user: validatedUser}, {headers: this.reqHeaders}).
validateUser(pinString:string){
this.http.post(this.beUrl+'api/validateuser', {pin: pinString, session: this.dataStore.user.session}, {headers: this.reqHeaders, observe: 'response'}).
subscribe((responseData) => {
console.log(responseData.message);
if (responseData.status == 202) {
console.log('Pin validated!');
} else {
console.log('Wrong pin!');
}
});
}