Update pin validation logic

This commit is contained in:
Rene Vergara 2022-05-20 13:41:48 -05:00
parent 916d4a0088
commit 8b1f2b075e
Signed by: pitmutt
GPG Key ID: 65122AD495A7F5B2
2 changed files with 13 additions and 4 deletions

View File

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

View File

@ -124,14 +124,18 @@ export class UserService{
validateUser(pinString:string){
const params = new HttpParams().append('session', this.dataStore.user.session).append('pin', pinString);
this.http.post(this.beUrl+'api/validateuser', {}, {headers: this.reqHeaders, params: params, observe: 'response'}).
subscribe((responseData) => {
let obs = this.http.post(this.beUrl+'api/validateuser', {}, {headers: this.reqHeaders, params: params, observe: 'response'});
obs.subscribe((responseData) => {
if (responseData.status == 202) {
console.log('Pin validated!');
return true;
} else {
console.log('Wrong pin!');
return false;
}
});
return obs;
}
addOwner(owner: Owner) {