Permalink
Browse files

Step 11.10: Implemented the signin logic

  • Loading branch information...
dotansimha authored and Dotan Simha committed Sep 22, 2016
1 parent 5847524 commit 338750e3ebc52261ae0beb03864f361c8e8c1032
Showing with 36 additions and 2 deletions.
  1. +36 −2 client/imports/components/signin.component.ts
@@ -1,7 +1,41 @@
import {Component} from "@angular/core";
import {Component, NgZone} from "@angular/core";
import {Router} from "@angular/router";
class SigninModel {
constructor(public email : string, public password : string) {
}
}
@Component({
template: 'Signin!'
templateUrl: '/client/imports/components/signin.html'
})
export class SigninComponent {
private model : SigninModel;
private errors : Array<string> = [];
constructor(private router: Router, private ngZone: NgZone) {
this.model = new SigninModel('', '');
}
resetErrors() {
this.errors = [];
}
join() {
this.resetErrors();
Meteor.loginWithPassword(this.model.email, this.model.password, (err) => {
if (err) {
this.ngZone.run(() => {
this.errors.push(err.reason);
});
return;
}
this.router.navigate(['/']);
});
}
}

0 comments on commit 338750e

Please sign in to comment.