Skip to content
Snippets Groups Projects
Unverified Commit 6cfa4b90 authored by Secteur Geek's avatar Secteur Geek Committed by GitHub
Browse files

Testbranch (#66)


* Fix Oser to OSER (#55)

* adds support for personnal data

* modifie le form pour inclure la nationalité

* supprime le gg form

* supprime le champ section et ajoute la liste des etablissements

* adapts for user

* adds validation and connects to students api for personnal data

* adds classType field and rgpd info

* corrects scholarships

* removes signup file tab

* minor presentation changes

* deletes random console.log

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* filters if the whole list is sent back

* adds message after personnal data modifications

* fix Oser to OSER

* Validated signup file display (#57)

* Modify inscription page (#32)

* modify the order of blocks

* Update dependencies and TravisCI build (#33)

* Update dependencies via a clean npm install

* Use Node.js 10 in Travis CI

* Specify node==10.x for Heroku

* adds support for personnal data

* modifie le form pour inclure la nationalité

* supprime le gg form

* supprime le champ section et ajoute la liste des etablissements

* adapts for user

* adds validation and connects to students api for personnal data

* adds classType field and rgpd info

* corrects scholarships

* removes signup file tab

* minor presentation changes

* deletes random console.log

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* filters if the whole list is sent back

* adds message after personnal data modifications

* adds untested frontend support for showing validated status of signup file

* adds phone number validation for personnal data

* checks for year field in registration to display correct status

Co-authored-by: default avatarAurianeStrasser2 <32937502+AurianeStrasser2@users.noreply.github.com>
Co-authored-by: default avatarchiahetcho <44137047+chiahetcho@users.noreply.github.com>
Co-authored-by: default avatarFlorimond Manca <florimond.manca@gmail.com>
Co-authored-by: default avatarDylan Sechet <dylan.sechet82@gmail.com>

* Personnal data fix (#58)

* adds support for personnal data

* modifie le form pour inclure la nationalité

* supprime le gg form

* supprime le champ section et ajoute la liste des etablissements

* adapts for user

* adds validation and connects to students api for personnal data

* adds classType field and rgpd info

* corrects scholarships

* removes signup file tab

* minor presentation changes

* deletes random console.log

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* filters if the whole list is sent back

* adds message after personnal data modifications

* adds some options and fixes wrong scholarship in the personnal data form

* adds info on phone number format (#61)

* Modify inscription page (#32)

* modify the order of blocks

* Update dependencies and TravisCI build (#33)

* Update dependencies via a clean npm install

* Use Node.js 10 in Travis CI

* Specify node==10.x for Heroku

* adds support for personnal data

* modifie le form pour inclure la nationalité

* supprime le gg form

* supprime le champ section et ajoute la liste des etablissements

* adapts for user

* adds validation and connects to students api for personnal data

* adds classType field and rgpd info

* corrects scholarships

* removes signup file tab

* minor presentation changes

* deletes random console.log

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* filters if the whole list is sent back

* adds message after personnal data modifications

* Validated signup file display (#54)

* adds support for personnal data

* modifie le form pour inclure la nationalité

* supprime le gg form

* supprime le champ section et ajoute la liste des etablissements

* adapts for user

* adds validation and connects to students api for personnal data

* adds classType field and rgpd info

* corrects scholarships

* removes signup file tab

* minor presentation changes

* deletes random console.log

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* filters if the whole list is sent back

* adds message after personnal data modifications

* adds untested frontend support for showing validated status of signup file

* adds phone number validation for personnal data

* checks for year field in registration to display correct status

* adds some options and fixes wrong scholarship in the personnal data form

* adds info on phone number format

Co-authored-by: default avatarAurianeStrasser2 <32937502+AurianeStrasser2@users.noreply.github.com>
Co-authored-by: default avatarchiahetcho <44137047+chiahetcho@users.noreply.github.com>
Co-authored-by: default avatarFlorimond Manca <florimond.manca@gmail.com>
Co-authored-by: default avatarDylan Sechet <dylan.sechet82@gmail.com>

* Update student-signup.component.html (#62)

* Improve error message (#63)

* adds support for personnal data

* modifie le form pour inclure la nationalité

* supprime le gg form

* supprime le champ section et ajoute la liste des etablissements

* adapts for user

* adds validation and connects to students api for personnal data

* adds classType field and rgpd info

* corrects scholarships

* removes signup file tab

* minor presentation changes

* deletes random console.log

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* filters if the whole list is sent back

* adds message after personnal data modifications

* improves phone number validation format

* adds error message when email is already used and redirects after signup (#64)

* adds support for personnal data

* modifie le form pour inclure la nationalité

* supprime le gg form

* supprime le champ section et ajoute la liste des etablissements

* adapts for user

* adds validation and connects to students api for personnal data

* adds classType field and rgpd info

* corrects scholarships

* removes signup file tab

* minor presentation changes

* deletes random console.log

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* changes upload component declarations

* filters if the whole list is sent back

* adds message after personnal data modifications

* improves phone number validation format

* adds message when email already used and redirects after signup

* ajout champ confirmation email

* supprime elements inutiles

Co-authored-by: default avatarArthur Guédon <60623551+arthurgdn@users.noreply.github.com>
Co-authored-by: default avatarAurianeStrasser2 <32937502+AurianeStrasser2@users.noreply.github.com>
Co-authored-by: default avatarchiahetcho <44137047+chiahetcho@users.noreply.github.com>
Co-authored-by: default avatarFlorimond Manca <florimond.manca@gmail.com>
Co-authored-by: default avatarDylan Sechet <dylan.sechet82@gmail.com>
Co-authored-by: default avatarfeli vigneau <feli.vigneau@student-cs.fr>
Co-authored-by: default avatarArthur Guédon <arthur.guedon@student-cs.fr>
parent 2d79e5a2
No related branches found
No related tags found
No related merge requests found
{
"python.pythonPath": "C:\\Users\\feliv\\anaconda3\\python.exe"
}
\ No newline at end of file
import { FormControl, FormGroupDirective, NgForm } from '@angular/forms';
import { ErrorStateMatcher } from '@angular/material';
// From: https://stackoverflow.com/a/51606362
export class EmailErrorStateMatcher implements ErrorStateMatcher {
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const invalidParent = !!(control && control.parent && control.parent.invalid && control.parent.dirty);
return (control && control.dirty && invalidParent);
}
}
\ No newline at end of file
...@@ -3,3 +3,4 @@ export * from './registration.service'; ...@@ -3,3 +3,4 @@ export * from './registration.service';
export * from './personnalData.model'; export * from './personnalData.model';
export * from './personnalData.service'; export * from './personnalData.service';
export * from './password.matcher'; export * from './password.matcher';
export * from './email.matcher';
...@@ -26,6 +26,15 @@ ...@@ -26,6 +26,15 @@
</mat-hint> </mat-hint>
</mat-form-field> </mat-form-field>
<!-- Confirm Email -->
<mat-form-field class="full-width">
<input matInput type="email" formControlName="emailConfirm" placeholder="Confirmer l'adresse email"
[errorStateMatcher]="emailMatcher">
<mat-error *ngIf="formGroup.hasError('emailsDifferent')">
Les adresses emails doivent être identiques.
</mat-error>
</mat-form-field>
<mat-form-field class="full-width"> <mat-form-field class="full-width">
<input matInput type="tel" formControlName="phoneNumber" placeholder="Numéro de téléphone" required> <input matInput type="tel" formControlName="phoneNumber" placeholder="Numéro de téléphone" required>
<mat-hint> <mat-hint>
...@@ -46,7 +55,7 @@ ...@@ -46,7 +55,7 @@
<!-- Confirm password --> <!-- Confirm password -->
<mat-form-field class="full-width"> <mat-form-field class="full-width">
<input matInput type="password" formControlName="passwordConfirm" placeholder="Confirmer le mot de passe" <input matInput type="password" formControlName="passwordConfirm" placeholder="Confirmer le mot de passe"
[errorStateMatcher]="matcher"> [errorStateMatcher]="passwordMatcher">
<mat-error *ngIf="formGroup.hasError('passwordsDifferent')"> <mat-error *ngIf="formGroup.hasError('passwordsDifferent')">
Les mots de passe doivent être identiques. Les mots de passe doivent être identiques.
</mat-error> </mat-error>
......
...@@ -4,7 +4,7 @@ import { Router } from '@angular/router'; ...@@ -4,7 +4,7 @@ import { Router } from '@angular/router';
import { MatSnackBar } from '@angular/material'; import { MatSnackBar } from '@angular/material';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { tap, mergeMap } from 'rxjs/operators'; import { tap, mergeMap } from 'rxjs/operators';
import { Registration, RegistrationService, PasswordErrorStateMatcher,PersonnalData,PersonnalDataService } from '../core'; import { Registration, RegistrationService, PasswordErrorStateMatcher, EmailErrorStateMatcher, PersonnalData, PersonnalDataService } from '../core';
import { AuthService } from 'app/core'; import { AuthService } from 'app/core';
...@@ -52,7 +52,8 @@ export class StudentSignupComponent implements OnInit { ...@@ -52,7 +52,8 @@ export class StudentSignupComponent implements OnInit {
{ id: "no", name: "Non" }, { id: "no", name: "Non" },
] ]
matcher = new PasswordErrorStateMatcher(); passwordMatcher = new PasswordErrorStateMatcher();
emailMatcher = new EmailErrorStateMatcher();
constructor( constructor(
private registrationService: RegistrationService, private registrationService: RegistrationService,
...@@ -74,6 +75,7 @@ export class StudentSignupComponent implements OnInit { ...@@ -74,6 +75,7 @@ export class StudentSignupComponent implements OnInit {
firstName: '', firstName: '',
lastName: '', lastName: '',
email: ['', Validators.email], email: ['', Validators.email],
emailConfirm: '',
phoneNumber: '', phoneNumber: '',
gender: '', gender: '',
adressNumber: '', adressNumber: '',
...@@ -97,7 +99,7 @@ export class StudentSignupComponent implements OnInit { ...@@ -97,7 +99,7 @@ export class StudentSignupComponent implements OnInit {
agree: [false, Validators.required], agree: [false, Validators.required],
filledForm: false, filledForm: false,
acceptedConditions: false, acceptedConditions: false,
}, { validator: (group) => this.checkPasswords(group)},) }, { validator:[(group) => this.checkPasswords(group), (group)=>this.checkEmails(group)] })
console.log(this.formGroup.value.agree) console.log(this.formGroup.value.agree)
} }
...@@ -106,15 +108,17 @@ export class StudentSignupComponent implements OnInit { ...@@ -106,15 +108,17 @@ export class StudentSignupComponent implements OnInit {
const passwordConfirm = group.controls.passwordConfirm.value; const passwordConfirm = group.controls.passwordConfirm.value;
return password === passwordConfirm ? null : { passwordsDifferent: true }; return password === passwordConfirm ? null : { passwordsDifferent: true };
} }
toggleShowPersonnalDataForm(){ private checkEmails(group: FormGroup): null | any {
this.showPersonnalDataForm = !this.showPersonnalDataForm; const email = group.controls.email.value;
const emailConfirm = group.controls.emailConfirm.value;
return email === emailConfirm ? null : { emailsDifferent: true };
} }
submit() { submit() {
this.loading = true; this.loading = true;
const { email, firstName, lastName, phoneNumber } = this.formGroup.value const { email, firstName, lastName, phoneNumber } = this.formGroup.value
//const {gender,adressNumber,street,zipCode,city,personnalPhone,parentsPhone,parentsEmail,school,grade,section,specialTeaching,scholarship,fatherActivity,motherActivity,parentsStatus,dependantsNumber} = this.formGroup.value;
const registration: Registration = { email, firstName, lastName, phoneNumber }; const registration: Registration = { email, firstName, lastName, phoneNumber };
// const personnalData: PersonnalData = {gender,adressNumber,street,zipCode,city,personnalPhone,parentsPhone,parentsEmail,school,grade,section,specialTeaching,scholarship,fatherActivity,motherActivity,parentsStatus,dependantsNumber};
const password: string = this.formGroup.controls.password.value; const password: string = this.formGroup.controls.password.value;
this.registrationService.create(registration, password).pipe( this.registrationService.create(registration, password).pipe(
...@@ -130,7 +134,8 @@ export class StudentSignupComponent implements OnInit { ...@@ -130,7 +134,8 @@ export class StudentSignupComponent implements OnInit {
setTimeout(() => { setTimeout(() => {
this.router.navigate(['./membres']) this.router.navigate(['./membres'])
},3000)}) }, 3000)
})
).subscribe( ).subscribe(
() => { }, () => { },
...@@ -143,6 +148,7 @@ export class StudentSignupComponent implements OnInit { ...@@ -143,6 +148,7 @@ export class StudentSignupComponent implements OnInit {
this.error = "Erreur, cet email est déjà utilisé !" this.error = "Erreur, cet email est déjà utilisé !"
} }
} }
); );
// this.personnalDataService.create(personnalData).pipe( // this.personnalDataService.create(personnalData).pipe(
// tap(() => this.loading = false), // tap(() => this.loading = false),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment