Permalink
Browse files

Step 22.12: Implement a code verification

  • Loading branch information...
1 parent 77df4c7 commit 5ad29625d2428fc0ca034778e73c88acdf03b34a @dotansimha dotansimha committed with DAB0mB Sep 27, 2016
Showing with 23 additions and 0 deletions.
  1. +23 −0 client/imports/app/auth/login.component.mobile.ts
@@ -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() {
@@ -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(['/']);
}
});
});

0 comments on commit 5ad2962

Please sign in to comment.