diff --git a/src/app/pourLes3Roles/register/page-register/page-register.component.html b/src/app/pourLes3Roles/register/page-register/page-register.component.html index adf0992..5ea96d6 100644 --- a/src/app/pourLes3Roles/register/page-register/page-register.component.html +++ b/src/app/pourLes3Roles/register/page-register/page-register.component.html @@ -25,7 +25,7 @@
Mot de passe:  
- +
@@ -33,7 +33,7 @@
Confirmer le mot de passe:  
- +
diff --git a/src/app/pourLes3Roles/register/page-register/page-register.component.ts b/src/app/pourLes3Roles/register/page-register/page-register.component.ts index 5d36a09..7edfecb 100644 --- a/src/app/pourLes3Roles/register/page-register/page-register.component.ts +++ b/src/app/pourLes3Roles/register/page-register/page-register.component.ts @@ -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' )); } } - } diff --git a/src/app/pourLes3Roles/register/popup-confirmation/popup-confirmation.component.html b/src/app/pourLes3Roles/register/popup-confirmation/popup-confirmation.component.html new file mode 100644 index 0000000..1eebca5 --- /dev/null +++ b/src/app/pourLes3Roles/register/popup-confirmation/popup-confirmation.component.html @@ -0,0 +1,4 @@ +

Votre inscription a bien été effectué.

+
+ +
diff --git a/src/app/pourLes3Roles/register/popup-confirmation/popup-confirmation.component.scss b/src/app/pourLes3Roles/register/popup-confirmation/popup-confirmation.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pourLes3Roles/register/popup-confirmation/popup-confirmation.component.spec.ts b/src/app/pourLes3Roles/register/popup-confirmation/popup-confirmation.component.spec.ts new file mode 100644 index 0000000..d6f9908 --- /dev/null +++ b/src/app/pourLes3Roles/register/popup-confirmation/popup-confirmation.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PopupConfirmationComponent } from './popup-confirmation.component'; + +describe('PopupConfirmationComponent', () => { + let component: PopupConfirmationComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ PopupConfirmationComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(PopupConfirmationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pourLes3Roles/register/popup-confirmation/popup-confirmation.component.ts b/src/app/pourLes3Roles/register/popup-confirmation/popup-confirmation.component.ts new file mode 100644 index 0000000..09d5501 --- /dev/null +++ b/src/app/pourLes3Roles/register/popup-confirmation/popup-confirmation.component.ts @@ -0,0 +1,18 @@ +import {Component, Inject, OnInit} from '@angular/core'; +import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; + +@Component({ + selector: 'app-popup-confirmation', + templateUrl: './popup-confirmation.component.html', + styleUrls: ['./popup-confirmation.component.scss'] +}) +export class PopupConfirmationComponent +{ + constructor( public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data) {} + + onClick(): void + { + this.dialogRef.close(); + } +}