Update pin validation logic
This commit is contained in:
parent
916d4a0088
commit
8b1f2b075e
2 changed files with 13 additions and 4 deletions
|
@ -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(){
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue