diff --git a/src/app/core/data/eperson-registration.service.ts b/src/app/core/data/eperson-registration.service.ts index bfbecdaecb..80bc56c037 100644 --- a/src/app/core/data/eperson-registration.service.ts +++ b/src/app/core/data/eperson-registration.service.ts @@ -14,6 +14,7 @@ import { RemoteData } from './remote-data'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { HttpOptions } from '../dspace-rest/dspace-rest.service'; import { HttpHeaders } from '@angular/common/http'; +import {HttpParams} from "@angular/common/http"; @Injectable({ providedIn: 'root', @@ -55,7 +56,7 @@ export class EpersonRegistrationService { * @param email * @param captchaToken the value of x-recaptcha-token header */ - registerEmail(email: string, captchaToken: string = null): Observable> { + registerEmail(email: string, captchaToken: string = null, type?: string): Observable> { const registration = new Registration(); registration.email = email; @@ -69,6 +70,7 @@ export class EpersonRegistrationService { headers = headers.append('x-recaptcha-token', captchaToken); } options.headers = headers; + options.params = type? new HttpParams({fromString:'type='+type}): new HttpParams(); href$.pipe( find((href: string) => hasValue(href)), 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 81d425c468..583c314f4a 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 {{ valid_mail_domains.join(", ")}}

+

{{ MESSAGE_PREFIX + '.info.maildomain' | translate}} {{ 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 465775bd1d..42a015b3d7 100644 --- a/src/app/register-email-form/register-email-form.component.ts +++ b/src/app/register-email-form/register-email-form.component.ts @@ -58,7 +58,7 @@ export class RegisterEmailFormComponent implements OnInit { captchaMode(): Observable { return this.googleRecaptchaService.captchaMode(); } - valid_mail_domains: string[]; + validMailDomains: string[]; constructor( private epersonRegistrationService: EpersonRegistrationService, @@ -85,6 +85,7 @@ export class RegisterEmailFormComponent implements OnInit { ], }) }); + this.validMailDomains = []; this.configService.findByPropertyName('registration.verification.enabled').pipe( getFirstSucceededRemoteDataPayload(), map((res: ConfigurationProperty) => res?.values[0].toLowerCase() === 'true') @@ -96,16 +97,6 @@ export class RegisterEmailFormComponent implements OnInit { this.disableUntilChecked = res; this.changeDetectorRef.detectChanges(); }); - - this.valid_mail_domains = []; - this.configService.findByPropertyName('authentication-password.domain.valid') - .pipe(getAllCompletedRemoteData()) - .subscribe((remoteData) => { - for (const remoteValue of remoteData.payload.values) { - this.valid_mail_domains.push(remoteValue); - } - } - ); } /** @@ -154,9 +145,13 @@ export class RegisterEmailFormComponent implements OnInit { * Registration of an email address */ registration(captchaToken = null) { + let typeMap = new Map([ + ["register-page.registration", "register"], + ["forgot-email.form", "forgot"] + ]); let registerEmail$ = captchaToken ? - this.epersonRegistrationService.registerEmail(this.email.value, captchaToken) : - this.epersonRegistrationService.registerEmail(this.email.value); + this.epersonRegistrationService.registerEmail(this.email.value, captchaToken, typeMap.get(this.MESSAGE_PREFIX)) : + this.epersonRegistrationService.registerEmail(this.email.value,typeMap.get(this.MESSAGE_PREFIX)); registerEmail$.subscribe((response: RemoteData) => { if (response.hasSucceeded) { this.notificationService.success(this.translateService.get(`${this.MESSAGE_PREFIX}.success.head`), diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 5ff9a101a0..51937f4b1b 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -3294,6 +3294,7 @@ "register-page.registration.google-recaptcha.notification.message.error": "An error occurred during reCaptcha verification", "register-page.registration.google-recaptcha.notification.message.expired": "Verification expired. Please verify again.", + "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",