affichage de message d erreur lors du login
This commit is contained in:
parent
547740dd44
commit
b0c15f976b
@ -24,8 +24,13 @@
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
<a routerLink="/password-oublie" routerLinkActive="active-custom" class="nav-link">password perdu ?</a>
|
<a routerLink="/password-oublie" routerLinkActive="active-custom" class="nav-link">password perdu ?</a>
|
||||||
<div *ngIf="errorForm">
|
<!-- <div *ngIf="errorForm">
|
||||||
<p class="text-danger">Il manque des informations dans le formulaire...</p>
|
<p class="text-danger">Il manque des informations dans le formulaire...</p>
|
||||||
|
</div> -->
|
||||||
|
<div *ngIf="isShow">
|
||||||
|
<div class="alert alert-{{alert.type}}" role="alert">
|
||||||
|
{{alert.content}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
@ -14,9 +14,10 @@ import {
|
|||||||
styleUrls: ['./signin.component.scss'],
|
styleUrls: ['./signin.component.scss'],
|
||||||
})
|
})
|
||||||
export class SigninComponent implements OnInit {
|
export class SigninComponent implements OnInit {
|
||||||
public errorForm: boolean;
|
alert : any;
|
||||||
|
isShow : boolean;
|
||||||
constructor(private authService: AuthService, private router: Router) {
|
constructor(private authService: AuthService, private router: Router) {
|
||||||
this.errorForm = false;
|
this.isShow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {}
|
ngOnInit(): void {}
|
||||||
@ -26,18 +27,21 @@ export class SigninComponent implements OnInit {
|
|||||||
const email = submittedForm.form.value['email'];
|
const email = submittedForm.form.value['email'];
|
||||||
const password = submittedForm.form.value['password'];
|
const password = submittedForm.form.value['password'];
|
||||||
if (email !== '' && password !== '') {
|
if (email !== '' && password !== '') {
|
||||||
this.authService.signin(email, password).subscribe((resp) => {
|
this.authService.signin(email, password).subscribe(
|
||||||
console.log('Component Signin: ', resp);
|
{
|
||||||
//if(resp == ){
|
next: resp => {
|
||||||
this.router.navigate(['tableau-de-bord']);
|
this.router.navigate(['tableau-de-bord']);
|
||||||
//}else{
|
},
|
||||||
// window.alert("Votre identifiant/mot de passe est erroné");
|
error: err => {
|
||||||
//}
|
this.alert={"type":"danger", "content":"Le login ou paswword est invalide"};
|
||||||
console.log('Component Signin: ', resp);
|
this.isShow = true;
|
||||||
|
},
|
||||||
|
complete: () => console.log('DONE!')
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// afficher une erreur à l'utilisateur
|
// afficher une erreur à l'utilisateur
|
||||||
this.errorForm = true;
|
this.alert={"type":"danger", "content":"Le login ou password est invalide"};
|
||||||
|
this.isShow = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user