-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
register enhancement #2575
register enhancement #2575
Changes from 4 commits
80ff10e
de3c8fe
585767b
fc43651
afb7958
90faf93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ import { CommonService } from '@geonature_common/service/common.service'; | |
|
||
import { AuthService } from '../../../components/auth/auth.service'; | ||
import { ConfigService } from '@geonature/services/config.service'; | ||
|
||
@Component({ | ||
selector: 'pnx-signup', | ||
templateUrl: './sign-up.component.html', | ||
|
@@ -19,6 +18,7 @@ export class SignUpComponent implements OnInit { | |
public disableSubmit = false; | ||
public formControlBuilded = false; | ||
public FORM_CONFIG = null; | ||
public errorMsg = ''; | ||
|
||
constructor( | ||
private fb: UntypedFormBuilder, | ||
|
@@ -57,21 +57,33 @@ export class SignUpComponent implements OnInit { | |
|
||
save() { | ||
if (this.form.valid) { | ||
this.errorMsg = ''; // raz de l'erreur | ||
this.disableSubmit = true; | ||
const finalForm = Object.assign({}, this.form.value); | ||
// concatenate two forms | ||
finalForm['champs_addi'] = {}; | ||
if (this.config.ACCOUNT_MANAGEMENT.ACCOUNT_FORM.length > 0) { | ||
finalForm['champs_addi'] = this.dynamicFormGroup.value; | ||
} | ||
// ajout de organisme aux champs addi | ||
finalForm['champs_addi']['organisme'] = this.form.value['organisme']; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enlever organisme des champs prédéfinis et le mettre dans les champs additionnels There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Les champs additionels sont optionnels et à définir dans la config c'est pas mal au final de garder ce champs dans les champs prédéfinis There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oui on peut se demander si au final on n'en fait pas juste un champs additionnel optionnel et que chacun se le met ou pas... |
||
this._authService | ||
.signupUser(finalForm) | ||
.subscribe(() => { | ||
const callbackMessage = this.config.ACCOUNT_MANAGEMENT.AUTO_ACCOUNT_CREATION | ||
? 'AutoAccountEmailConfirmation' | ||
: 'AdminAccountEmailConfirmation'; | ||
this._commonService.translateToaster('info', callbackMessage); | ||
this._router.navigate(['/login']); | ||
}) | ||
.subscribe( | ||
() => { | ||
const callbackMessage = this.config.ACCOUNT_MANAGEMENT.AUTO_ACCOUNT_CREATION | ||
? 'AutoAccountEmailConfirmation' | ||
: 'AdminAccountEmailConfirmation'; | ||
this._commonService.translateToaster('info', callbackMessage); | ||
this._router.navigate(['/login']); | ||
}, | ||
(error) => { | ||
// affichage de l'erreur renvoyé par l'api | ||
if (error.error.msg) { | ||
this.errorMsg = error.error.msg; | ||
} | ||
} | ||
) | ||
.add(() => { | ||
this.disableSubmit = false; | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Voir si ce n'est pas plus pertinent d'avoir un champ organisme basé sur bib_organisme + champ texte autre organisme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pour l'instant on reste sur un champs texte dans le formulaire de création de compte.
Mais oui, ça serait bien à terme.