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(){
|
||||
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(){
|
||||
|
|
|
@ -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!');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue