From 7917f612106b63810eb3ed5556eb1ccc005e0ce7 Mon Sep 17 00:00:00 2001 From: Joost Date: Tue, 13 Dec 2022 11:11:42 +0100 Subject: [PATCH 1/4] typo fix --- src/app/register-email-form/register-email-form.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/register-email-form/register-email-form.component.html b/src/app/register-email-form/register-email-form.component.html index b76fa521e2..15c68d322f 100644 --- a/src/app/register-email-form/register-email-form.component.html +++ b/src/app/register-email-form/register-email-form.component.html @@ -1,7 +1,7 @@

{{MESSAGE_PREFIX + '.header'|translate}}

{{MESSAGE_PREFIX + '.info' | translate}}

-

Accounts can be registered for mail addresses of the domanins {{ valid_mail_domains.join(", ")}}

+

Accounts can be registered for mail addresses of the domains {{ valid_mail_domains.join(", ")}}

From 8f6db1f6a095c6eeb57bf5f859c2e2ca15b1553f Mon Sep 17 00:00:00 2001 From: Joost Date: Mon, 19 Dec 2022 16:43:02 +0100 Subject: [PATCH 2/4] lint fixes --- .../register-email-form.component.html | 2 +- .../register-email-form.component.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/app/register-email-form/register-email-form.component.html b/src/app/register-email-form/register-email-form.component.html index 15c68d322f..ee620e1e6d 100644 --- a/src/app/register-email-form/register-email-form.component.html +++ b/src/app/register-email-form/register-email-form.component.html @@ -1,7 +1,7 @@

{{MESSAGE_PREFIX + '.header'|translate}}

{{MESSAGE_PREFIX + '.info' | translate}}

-

Accounts can be registered for mail addresses of the domains {{ valid_mail_domains.join(", ")}}

+

Accounts can be registered for mail addresses of the domains {{ validMailDomains.join(", ")}}

diff --git a/src/app/register-email-form/register-email-form.component.ts b/src/app/register-email-form/register-email-form.component.ts index 09548def92..6c83e9a4de 100644 --- a/src/app/register-email-form/register-email-form.component.ts +++ b/src/app/register-email-form/register-email-form.component.ts @@ -6,8 +6,8 @@ import {Router} from '@angular/router'; import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms'; import {Registration} from '../core/shared/registration.model'; import {RemoteData} from '../core/data/remote-data'; -import {ConfigurationDataService} from "../core/data/configuration-data.service"; -import {getAllCompletedRemoteData} from "../core/shared/operators"; +import {ConfigurationDataService} from '../core/data/configuration-data.service'; +import {getAllCompletedRemoteData} from '../core/shared/operators'; @Component({ selector: 'ds-register-email-form', @@ -29,7 +29,7 @@ export class RegisterEmailFormComponent implements OnInit { @Input() MESSAGE_PREFIX: string; - valid_mail_domains: string[]; + validMailDomains: string[]; constructor( private epersonRegistrationService: EpersonRegistrationService, @@ -49,12 +49,12 @@ export class RegisterEmailFormComponent implements OnInit { ], }) }); - this.valid_mail_domains = []; + this.validMailDomains = []; this.configurationService.findByPropertyName('authentication-password.domain.valid') .pipe(getAllCompletedRemoteData()) .subscribe((remoteData) => { for (const remoteValue of remoteData.payload.values) { - this.valid_mail_domains.push(remoteValue); + this.validMailDomains.push(remoteValue); } } ); @@ -70,12 +70,12 @@ export class RegisterEmailFormComponent implements OnInit { this.notificationService.success(this.translateService.get(`${this.MESSAGE_PREFIX}.success.head`), this.translateService.get(`${this.MESSAGE_PREFIX}.success.content`, {email: this.email.value})); this.router.navigate(['/home']); - } else if (response.statusCode == 400) { - this.notificationService.error(this.translateService.get(`${this.MESSAGE_PREFIX}.error.head`), this.translateService.get(`${this.MESSAGE_PREFIX}.error.maildomain`, { domains: this.valid_mail_domains.join(", ")})); + } else if (response.statusCode === 400) { + this.notificationService.error(this.translateService.get(`${this.MESSAGE_PREFIX}.error.head`), this.translateService.get(`${this.MESSAGE_PREFIX}.error.maildomain`, { domains: this.validMailDomains.join(', ')})); } else { this.notificationService.error(this.translateService.get(`${this.MESSAGE_PREFIX}.error.head`), this.translateService.get(`${this.MESSAGE_PREFIX}.error.content`, {email: this.email.value})); - this.notificationService.error("title", response.errorMessage); + this.notificationService.error('title', response.errorMessage); } } ); From 3690dceb75dc027830df25345ec5a6537aeaf75f Mon Sep 17 00:00:00 2001 From: Joost Date: Tue, 20 Dec 2022 14:54:54 +0100 Subject: [PATCH 3/4] [task 97298] sending the type for registration --- src/app/core/data/eperson-registration.service.ts | 7 +++++-- .../register-email-form/register-email-form.component.ts | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/core/data/eperson-registration.service.ts b/src/app/core/data/eperson-registration.service.ts index adf01b0ce9..e1bdde262a 100644 --- a/src/app/core/data/eperson-registration.service.ts +++ b/src/app/core/data/eperson-registration.service.ts @@ -12,6 +12,7 @@ import { GenericConstructor } from '../shared/generic-constructor'; import { RegistrationResponseParsingService } from './registration-response-parsing.service'; import { RemoteData } from './remote-data'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import {HttpParams} from "@angular/common/http"; @Injectable( { @@ -54,7 +55,7 @@ export class EpersonRegistrationService { * Register a new email address * @param email */ - registerEmail(email: string): Observable> { + registerEmail(email: string, type?:string): Observable> { const registration = new Registration(); registration.email = email; @@ -62,10 +63,12 @@ export class EpersonRegistrationService { const href$ = this.getRegistrationEndpoint(); + let options = type? {params: new HttpParams({fromString:'type='+type})}: {} + href$.pipe( find((href: string) => hasValue(href)), map((href: string) => { - const request = new PostRequest(requestId, href, registration); + const request = new PostRequest(requestId, href, registration, options); this.requestService.send(request); }) ).subscribe(); diff --git a/src/app/register-email-form/register-email-form.component.ts b/src/app/register-email-form/register-email-form.component.ts index 6c83e9a4de..5daaf1d41c 100644 --- a/src/app/register-email-form/register-email-form.component.ts +++ b/src/app/register-email-form/register-email-form.component.ts @@ -64,8 +64,12 @@ export class RegisterEmailFormComponent implements OnInit { * Register an email address */ register() { + let typeMap = new Map([ + ["register-page.registration", "register"], + ["forgot-email.form", "forgot"] + ]); if (!this.form.invalid) { - this.epersonRegistrationService.registerEmail(this.email.value).subscribe((response: RemoteData) => { + this.epersonRegistrationService.registerEmail(this.email.value, typeMap.get(this.MESSAGE_PREFIX)).subscribe((response: RemoteData) => { 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})); From 3f7bdb284fae305239adb0946c2a1402847b8045 Mon Sep 17 00:00:00 2001 From: Joost Date: Tue, 20 Dec 2022 15:01:53 +0100 Subject: [PATCH 4/4] [task 97298] displaying mail domains only on register --- src/app/register-email-form/register-email-form.component.html | 3 ++- src/assets/i18n/en.json5 | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/register-email-form/register-email-form.component.html b/src/app/register-email-form/register-email-form.component.html index ee620e1e6d..a1eb0cef98 100644 --- a/src/app/register-email-form/register-email-form.component.html +++ b/src/app/register-email-form/register-email-form.component.html @@ -1,7 +1,8 @@

{{MESSAGE_PREFIX + '.header'|translate}}

{{MESSAGE_PREFIX + '.info' | translate}}

-

Accounts can be registered for mail addresses of the domains {{ validMailDomains.join(", ")}}

+

{{ MESSAGE_PREFIX + '.info.maildomain' | translate}} {{ validMailDomains.join(", ")}}

diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index a98eb50cac..8737bed9b3 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -3029,7 +3029,7 @@ "register-page.registration.error.maildomain": "this email address is not on the list of domains who can register. Allowed domains are {{ domains }}", - + "register-page.registration.info.maildomain": "Accounts can be registered for mail addresses of the domains", "relationships.add.error.relationship-type.content": "No suitable match could be found for relationship type {{ type }} between the two items",