Correct PIN processing
This commit is contained in:
parent
d6f48a8338
commit
55ee54cd4f
2 changed files with 9 additions and 11 deletions
|
@ -194,12 +194,8 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmPin(){
|
confirmPin(){
|
||||||
if (this.user.pin === this.pinForm.value.pinValue) {
|
this.userService.validateUser(this.pinForm.value.pinValue);
|
||||||
this.userService.validateUser();
|
this.loginCheck();
|
||||||
this.router.navigate(['/shop']);
|
|
||||||
} else {
|
|
||||||
this.pinError = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(){
|
ngOnDestroy(){
|
||||||
|
|
|
@ -122,12 +122,14 @@ export class UserService{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
validateUser(){
|
validateUser(pinString:string){
|
||||||
var validatedUser: User = this.dataStore.user;
|
this.http.post(this.beUrl+'api/validateuser', {pin: pinString, session: this.dataStore.user.session}, {headers: this.reqHeaders, observe: 'response'}).
|
||||||
validatedUser.validated = true;
|
|
||||||
this.http.post<{message: string, user: User}>(this.beUrl+'api/validateuser', {user: validatedUser}, {headers: this.reqHeaders}).
|
|
||||||
subscribe((responseData) => {
|
subscribe((responseData) => {
|
||||||
console.log(responseData.message);
|
if (responseData.status == 202) {
|
||||||
|
console.log('Pin validated!');
|
||||||
|
} else {
|
||||||
|
console.log('Wrong pin!');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue