Skip to content

Commit

Permalink
Step 22.12: Implement a code verification
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha authored and DAB0mB committed Dec 14, 2016
1 parent 77df4c7 commit 5ad2962
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions client/imports/app/auth/login.component.mobile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ export class MobileLoginComponent implements OnInit {
error: string = '';
phoneForm: FormGroup;
phone: string;
verifyForm: FormGroup;
isStepTwo: boolean = false;

constructor(private router: Router, private zone: NgZone, private formBuilder: FormBuilder) {}

ngOnInit() {
this.phoneForm = this.formBuilder.group({
phone: ['', Validators.required]
});

this.verifyForm = this.formBuilder.group({
code: ['', Validators.required]
});
}

send() {
Expand All @@ -31,6 +37,23 @@ export class MobileLoginComponent implements OnInit {
} else {
this.phone = this.phoneForm.value.phone;
this.error = '';
this.isStepTwo = true;
}
});
});
}
}


verify() {
if (this.verifyForm.valid) {
Accounts.verifyPhone(this.phone, this.verifyForm.value.code, (err) => {
this.zone.run(() => {
if (err) {
this.error = err.reason || err;
}
else {
this.router.navigate(['/']);
}
});
});
Expand Down

0 comments on commit 5ad2962

Please sign in to comment.