97298: #3281 Self-register - type request query param

This commit is contained in:
Marie Verdonck
2022-12-28 11:57:48 +01:00
parent c4f9bc4b1a
commit e4ce91fa73
3 changed files with 10 additions and 8 deletions

View File

@@ -1,3 +1,3 @@
<ds-register-email-form
[MESSAGE_PREFIX]="'forgot-email.form'">
[MESSAGE_PREFIX]="'forgot-email.form'" [typeRequest]="'forgot'">
</ds-register-email-form>

View File

@@ -29,6 +29,12 @@ export class RegisterEmailFormComponent implements OnInit {
@Input()
MESSAGE_PREFIX: string;
/**
* Type of register request to be done, register new email or forgot password (same endpoint)
*/
@Input()
typeRequest: string = null;
validMailDomains: string[];
constructor(
@@ -64,12 +70,8 @@ export class RegisterEmailFormComponent implements OnInit {
* Register an email address
*/
register() {
const typeMap = new Map<string, string>([
['register-page.registration', 'register'],
['forgot-email.form', 'forgot']
]);
if (!this.form.invalid) {
this.epersonRegistrationService.registerEmail(this.email.value, typeMap.get(this.MESSAGE_PREFIX)).subscribe((response: RemoteData<Registration>) => {
this.epersonRegistrationService.registerEmail(this.email.value, this.typeRequest).subscribe((response: RemoteData<Registration>) => {
if (response.hasSucceeded) {
this.notificationService.success(this.translateService.get(`${this.MESSAGE_PREFIX}.success.head`),
this.translateService.get(`${this.MESSAGE_PREFIX}.success.content`, {email: this.email.value}));

View File

@@ -1,3 +1,3 @@
<ds-register-email-form
[MESSAGE_PREFIX]="'register-page.registration'">
[MESSAGE_PREFIX]="'register-page.registration'" [typeRequest]="'register'">
</ds-register-email-form>