[task 97298] error message for not correct domain in registration mail

This commit is contained in:
Joost
2022-12-12 17:27:54 +01:00
parent f81d416daf
commit e0deed785e
3 changed files with 20 additions and 14 deletions

View File

@@ -1,8 +1,7 @@
<div class="container">
<h2>{{MESSAGE_PREFIX + '.header'|translate}}</h2>
<p>{{MESSAGE_PREFIX + '.info' | translate}}</p>
{{valid_mail_domains.length}}
<p *ngIf="valid_mail_domains.length!= 0">Accounts can be registered for mail addresses of the domanins <span *ngFor="let valid_domain of valid_mail_domains">{{valid_domain}}</span> </p>
<p *ngIf="valid_mail_domains.length!= 0">Accounts can be registered for mail addresses of the domanins {{ valid_mail_domains.join(", ")}} </p>
<form [class]="'ng-invalid'" [formGroup]="form" (ngSubmit)="register()">

View File

@@ -7,7 +7,7 @@ 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 {getFirstCompletedRemoteData} from "../core/shared/operators";
import {getAllCompletedRemoteData} from "../core/shared/operators";
@Component({
selector: 'ds-register-email-form',
@@ -51,9 +51,11 @@ export class RegisterEmailFormComponent implements OnInit {
});
this.valid_mail_domains = [];
this.configurationService.findByPropertyName('authentication-password.domain.valid')
.pipe(getFirstCompletedRemoteData())
.subscribe((remoteData) =>{
this.valid_mail_domains.push(remoteData.payload.values[0]);
.pipe(getAllCompletedRemoteData())
.subscribe((remoteData) => {
for (const remoteValue of remoteData.payload.values) {
this.valid_mail_domains.push(remoteValue);
}
}
);
}
@@ -64,14 +66,17 @@ export class RegisterEmailFormComponent implements OnInit {
register() {
if (!this.form.invalid) {
this.epersonRegistrationService.registerEmail(this.email.value).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}));
this.router.navigate(['/home']);
} else {
this.notificationService.error(this.translateService.get(`${this.MESSAGE_PREFIX}.error.head`),
this.translateService.get(`${this.MESSAGE_PREFIX}.error.content`, {email: this.email.value}));
}
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}));
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 {
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);
}
}
);
}

View File

@@ -3027,6 +3027,8 @@
"register-page.registration.error.content": "An error occured when registering the following email address: {{ email }}",
"register-page.registration.error.maildomain": "this email address is not on the list of domains who can register. Allowed domains are {{ domains }}",
"relationships.add.error.relationship-type.content": "No suitable match could be found for relationship type {{ type }} between the two items",