diff --git a/src/app/components/home/_dialogs/register/register.component.ts b/src/app/components/home/_dialogs/register/register.component.ts index 72bd99337c51aa68f8fadc5b6ddd9ae3e2f57ec7..5a757e982821220a68cf55cbd80cdc1345208c6a 100644 --- a/src/app/components/home/_dialogs/register/register.component.ts +++ b/src/app/components/home/_dialogs/register/register.component.ts @@ -79,12 +79,19 @@ export class RegisterComponent implements OnInit { !this.username2FormControl.hasError('required') && !this.username2FormControl.hasError('emailIsEqual') && !this.password1FormControl.hasError('required') && !this.password2FormControl.hasError('required') && !this.password2FormControl.hasError('passwordIsEqual')) { - this.authenticationService.register(username, password).subscribe(() => { - this.translationService.get('register.register-successful').subscribe(message => { - this.notificationService.show(message); - }); - this.dialogRef.close({ username: username, password: password }); - }); + this.authenticationService.register(username, password).subscribe( + (result) => { + this.translationService.get('register.register-successful').subscribe(message => { + this.notificationService.show(message); + }); + this.dialogRef.close({ username: username, password: password }); + }, + err => { + this.translationService.get('register.register-request-error').subscribe(message => { + this.notificationService.show(message); + }); + } + ); } else { this.translationService.get('register.register-unsuccessful').subscribe(message => { this.notificationService.show(message); diff --git a/src/app/services/http/authentication.service.ts b/src/app/services/http/authentication.service.ts index bc67345973184c84acad75632dbbebf687eaceb6..64127a9ae6fb896771760555eda67e90b5ec4e6d 100644 --- a/src/app/services/http/authentication.service.ts +++ b/src/app/services/http/authentication.service.ts @@ -77,9 +77,13 @@ export class AuthenticationService { return this.http.post(connectionUrl, { key: null, password: null - }, this.httpOptions).pipe(map(() => { - return true; - })); + }, this.httpOptions).pipe( + catchError(err => { + return of(false); + }), map((result) => { + return true; + }) + ); } logout() { diff --git a/src/assets/i18n/home/de.json b/src/assets/i18n/home/de.json index 77797047cf667d4655472e78df40d9f1d0dfff02..a5a5dbfe249aae3fc5c697d806e58c1003ffc7b3 100644 --- a/src/assets/i18n/home/de.json +++ b/src/assets/i18n/home/de.json @@ -67,7 +67,8 @@ "password-verify": "Passwort bestätigen", "register": "Registrieren", "register-successful": "Erfolgreich registriert. Bitte prüfen Sie Ihre E-mails", - "register-unsuccessful": "Bitte prüfen Sie Ihre Eingaben" + "register-unsuccessful": "Bitte prüfen Sie Ihre Eingaben", + "register-request-error": "Etwas ist bei der Registierung fehlgeschlagen. Haben Sie sich vielleicht schon registriert?" }, "session": { "session-name": "Name der Session", diff --git a/src/assets/i18n/home/en.json b/src/assets/i18n/home/en.json index ceee59c0408c06ff3c47fa81830d74ea4ab47fd7..8acaf4efcc8f15dc95d9e3bca522fd1a227ae5a6 100644 --- a/src/assets/i18n/home/en.json +++ b/src/assets/i18n/home/en.json @@ -67,7 +67,8 @@ "password-verify": "Verify password", "register": "Register", "register-successful": "Successfully registered. Please check your mail", - "register-unsuccessful": "Please check your data" + "register-unsuccessful": "Please check your data", + "register-request-error": "Something went wrong with the registration. Maybe you already made the account?" }, "session": { "session-name": "Session name",