|
|
|
@ -24,11 +24,13 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
parrain: Parrain;
|
|
|
|
|
commercant: Commercant;
|
|
|
|
|
echecLogin: boolean;
|
|
|
|
|
echecLoginEmailNotVerifed: boolean;
|
|
|
|
|
user: Observable<firebase.User>;
|
|
|
|
|
|
|
|
|
|
constructor(public afAuth: AngularFireAuth, public afDb: AngularFireDatabase,
|
|
|
|
|
private router: Router, private authService: AuthService) {
|
|
|
|
|
this.echecLogin = false;
|
|
|
|
|
this.echecLoginEmailNotVerifed = false;
|
|
|
|
|
this.user = afAuth.authState;
|
|
|
|
|
this.email = '';
|
|
|
|
|
this.password = '';
|
|
|
|
@ -44,7 +46,19 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
}
|
|
|
|
|
login() {
|
|
|
|
|
try {
|
|
|
|
|
this.authService.signIn(this.email, this.password).catch(e => this.echecLogin = true);
|
|
|
|
|
this.authService.signIn(this.email, this.password).catch(e => {
|
|
|
|
|
this.echecLogin = true;
|
|
|
|
|
this.echecLoginEmailNotVerifed = false;
|
|
|
|
|
});
|
|
|
|
|
this.user.subscribe(
|
|
|
|
|
(auth) => {
|
|
|
|
|
if(auth){
|
|
|
|
|
if(auth.emailVerified === false){
|
|
|
|
|
this.echecLogin = false;
|
|
|
|
|
this.echecLoginEmailNotVerifed = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}catch (e) {
|
|
|
|
|
console.log(e);
|
|
|
|
|
}
|
|
|
|
|