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(){
|
confirmPin(){
|
||||||
this.userService.validateUser(this.pinForm.value.pinValue);
|
this.userService.validateUser(this.pinForm.value.pinValue).subscribe((val) => {
|
||||||
this.loginCheck();
|
if (val) {
|
||||||
|
this.router.navigate(['/biz']);
|
||||||
|
} else {
|
||||||
|
this.pinError = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(){
|
ngOnDestroy(){
|
||||||
|
|
|
@ -124,14 +124,18 @@ export class UserService{
|
||||||
|
|
||||||
validateUser(pinString:string){
|
validateUser(pinString:string){
|
||||||
const params = new HttpParams().append('session', this.dataStore.user.session).append('pin', pinString);
|
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'}).
|
let obs = this.http.post(this.beUrl+'api/validateuser', {}, {headers: this.reqHeaders, params: params, observe: 'response'});
|
||||||
subscribe((responseData) => {
|
obs.subscribe((responseData) => {
|
||||||
if (responseData.status == 202) {
|
if (responseData.status == 202) {
|
||||||
console.log('Pin validated!');
|
console.log('Pin validated!');
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
console.log('Wrong pin!');
|
console.log('Wrong pin!');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
addOwner(owner: Owner) {
|
addOwner(owner: Owner) {
|
||||||
|
|
Loading…
Reference in a new issue