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

@ -25,7 +25,7 @@
<div class="row">
<div class="col-6 label"> Mot de passe: &nbsp; </div>
<div class="col-6 champ">
<input type="text" [(ngModel)]="password">
<input type="password" [(ngModel)]="password">
</div>
</div>
@ -33,7 +33,7 @@
<div class="row">
<div class="col-6 label"> Confirmer le mot de passe: &nbsp; </div>
<div class="col-6 champ">
<input type="text" [(ngModel)]="confirmPassword">
<input type="password" [(ngModel)]="confirmPassword">
</div>
</div>

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

View file

@ -0,0 +1,4 @@
<p> Votre inscription a bien été effectué. </p>
<div style="text-align: right">
<button mat-button mat-dialog-close> Continuer </button>
</div>

View file

@ -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<PopupConfirmationComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ PopupConfirmationComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(PopupConfirmationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -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<PopupConfirmationComponent>,
@Inject(MAT_DIALOG_DATA) public data) {}
onClick(): void
{
this.dialogRef.close();
}
}