message login email verifed ok

thierry
Tmadkaud 7 years ago
parent c285f637c2
commit 5ff7488f27

@ -29,9 +29,11 @@
<a (click)="loadResetPasswordComponent()" class="blue-text">Mot de passe oublié ?</a>
</div>
<div *ngIf="echecLogin" class="alert alert-danger">
Erreur: votre <strong>email/mot de passe n'est pas correct ou bien vous n'avez pas validé votre adresse email !</strong>.
Erreur: votre <strong>email/mot de passe n'est pas correct !</strong>.
</div>
<div *ngIf="echecLoginEmailNotVerifed" class="alert alert-danger">
Erreur: vous <strong> n'avez pas validé votre adresse email !</strong>.
</div>
</form>
</div>
</div>

@ -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);
}

@ -40,6 +40,7 @@ export class AuthService {
get authenticated(): boolean {
return this.authState !== null;
}
saveInfo(user: firebase.User, infoUser: any): boolean {
if (infoUser.status === 'Parrain') {
const userRef = this.databaseRef.child('Parrain').child(infoUser.uid);
@ -65,7 +66,7 @@ export class AuthService {
return e;
})
.then(user => {
if (user) {
if (user ) {
this.profileDataParrain = this.afDb.list('/Parrain/', {
query: {

Loading…
Cancel
Save