page register opérationnelle

This commit is contained in:
MiharyR 2021-10-26 09:12:41 +02:00
parent fd24009f87
commit 96285c0403
6 changed files with 62 additions and 4 deletions

View file

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import {MessageService} from "../../outils/message/message.service";
import {MessageService} from "../../../utils/message/message.service";
import {Router} from "@angular/router";
import {MatDialog} from "@angular/material/dialog";
import {PopupConfirmationComponent} from "../popup-confirmation/popup-confirmation.component";
@ -27,6 +27,13 @@ export class PageRegisterComponent implements OnInit
ngOnInit(): void {}
isValidEmail(email)
{
let re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
verifierChamps(): void
{
if(this.pseudo.length === 0) {
@ -38,6 +45,11 @@ export class PageRegisterComponent implements OnInit
this.errorMessage = "Veuillez remplir le champ 'email'"
this.hasError = true;
}
else if(!this.isValidEmail(this.email))
{
this.errorMessage = "Email invalide"
this.hasError = true;
}
else if(this.password.length === 0)
{
this.errorMessage = "Veuillez remplir le champ 'mot de passe'"
@ -80,5 +92,4 @@ export class PageRegisterComponent implements OnInit
.subscribe(result => this.router.navigateByUrl( '/connexion' ));
}
}
}