Skip to content
Snippets Groups Projects
Commit da9c502f authored by Lukas Mauß's avatar Lukas Mauß
Browse files

Merge branch 'react-on-user-register-error' into 'master'

Parse error on user register correctly

See merge request !179
parents 4837ee58 cafd91f6
1 merge request!179Parse error on user register correctly
Pipeline #26466 passed with stages
in 5 minutes and 51 seconds
......@@ -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);
......
......@@ -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() {
......
......@@ -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",
......
......@@ -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",
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment