Skip to content

Commit

Permalink
Merge pull request #116 from openstandia/MID-6154
Browse files Browse the repository at this point in the history
MID-6154 Fix error message to be localized in self registration page
  • Loading branch information
katkav committed Apr 2, 2020
2 parents 107139b + cd4deb2 commit daceb07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Expand Up @@ -547,6 +547,9 @@ public static void save(Collection<ObjectDelta<? extends ObjectType>> deltas, Mo

page.getModelService().executeChanges(deltas, options, task, result);
} catch (Exception ex) {
if (ex instanceof CommonException) {
subResult.setUserFriendlyMessage(((CommonException) ex).getUserFriendlyMessage());
}
subResult.recordFatalError(ex.getMessage());
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't save object", ex);
} finally {
Expand Down
Expand Up @@ -345,8 +345,14 @@ protected void submitRegistration(AjaxRequestTarget target) {
LOGGER.trace("Registration for user {} was successfull.", getUserModel().getObject());

} else {
String message;
if (result.getUserFriendlyMessage() != null) {
message = WebModelServiceUtils.translateMessage(result, this);
} else {
message = result.getMessage();
}
getSession().error(
createStringResource("PageSelfRegistration.registration.error", result.getMessage())
createStringResource("PageSelfRegistration.registration.error", message)
.getString());
// removePassword(target);
updateCaptcha(target);
Expand Down

0 comments on commit daceb07

Please sign in to comment.