|
|
|
@ -21,11 +21,13 @@ export class RegisterComponent implements OnInit, OnDestroy {
|
|
|
|
|
commercant: Commercant;
|
|
|
|
|
ConfirmPasswordParrain: String;
|
|
|
|
|
ConfirmPasswordCommercant: String;
|
|
|
|
|
test: boolean;
|
|
|
|
|
|
|
|
|
|
constructor(private router: Router, private authService: AuthService) {
|
|
|
|
|
this.currentUser = new User();
|
|
|
|
|
this.parrain = new Parrain();
|
|
|
|
|
this.commercant = new Commercant();
|
|
|
|
|
this.test = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
register() {
|
|
|
|
@ -33,10 +35,16 @@ export class RegisterComponent implements OnInit, OnDestroy {
|
|
|
|
|
this.parrain.status = this.currentUser.status;
|
|
|
|
|
this.parrain.secretCode = this.getRandomArbitrary(1111, 9999).toString();
|
|
|
|
|
this.authService.signUp(this.parrain);
|
|
|
|
|
this.test = true;
|
|
|
|
|
}else if (this.currentUser.status === 'Commercant') {
|
|
|
|
|
this.commercant.status = this.currentUser.status;
|
|
|
|
|
this.authService.signUp(this.commercant);
|
|
|
|
|
}
|
|
|
|
|
this.test = true;
|
|
|
|
|
}else if (this.test) {
|
|
|
|
|
this.ngOnDestroy();
|
|
|
|
|
this.currentUser.status = '';
|
|
|
|
|
this.test = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// On renvoie un nombre aléatoire entre une valeur min (incluse)
|
|
|
|
@ -48,6 +56,10 @@ export class RegisterComponent implements OnInit, OnDestroy {
|
|
|
|
|
loadHomeComponent() {
|
|
|
|
|
this.router.navigate(['/']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clicktest(){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
luhn(str) {
|
|
|
|
|
return str.split('').reduceRight(function(prev, curr, idx){
|
|
|
|
@ -73,7 +85,7 @@ export class RegisterComponent implements OnInit, OnDestroy {
|
|
|
|
|
email: '',
|
|
|
|
|
emailVerified: false,
|
|
|
|
|
password: '',
|
|
|
|
|
status: ''
|
|
|
|
|
status: this.currentUser.status
|
|
|
|
|
};
|
|
|
|
|
this.parrain = {
|
|
|
|
|
uid: '',
|
|
|
|
|