Merge pull request 'issue/19+20 Closes #19 #20' (#21) from issue/19+20 into master
nclazz/nclazz-mail-relay/pipeline/head Something is wrong with the build of this commit
Details
nclazz/nclazz-mail-relay/pipeline/head Something is wrong with the build of this commit
Details
Reviewed-on: #21master
commit
9efd92f844
|
@ -34,9 +34,19 @@ public class MailMessageForwarder implements MessageForwarder {
|
|||
mimeMessageHelper.setReplyTo(from);
|
||||
mimeMessageHelper.setTo(receivers.toArray(new String[0]));
|
||||
mimeMessageHelper.setSubject(subject);
|
||||
mimeMessageHelper.setText(content);
|
||||
mimeMessageHelper.setText(formatMail(content));
|
||||
|
||||
this.javaMailSender.send(mimeMessage);
|
||||
}
|
||||
|
||||
private String formatMail(String content) {
|
||||
StringBuilder sb = new StringBuilder(content);
|
||||
|
||||
sb.append("\n\n")
|
||||
.append("-----------------------------------\n")
|
||||
.append("Send via nclazz mail relay");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class MessageFormController {
|
|||
redirect = form.getOnSuccess();
|
||||
}
|
||||
|
||||
return "redirect:" + redirect;
|
||||
return "redirect:" + addRefererToRelativeUrl(referer, redirect);
|
||||
}
|
||||
|
||||
private String formatErrorRedirect(String referer, MessageForm form, BindingResult bindingResult) {
|
||||
|
@ -58,7 +58,14 @@ public class MessageFormController {
|
|||
.collect(Collectors.joining("&"));
|
||||
String origin = form.getOnError() != null ? form.getOnError() : referer;
|
||||
|
||||
return origin + "?" + queryParams;
|
||||
return addRefererToRelativeUrl(referer, origin) + "?" + queryParams;
|
||||
}
|
||||
|
||||
private String addRefererToRelativeUrl(String referer, String url) {
|
||||
if(!url.startsWith("/")) {
|
||||
return url;
|
||||
}
|
||||
return referer + url;
|
||||
}
|
||||
|
||||
private static String mapValidationErrorToQueryParam(ValidationError error) {
|
||||
|
|
Loading…
Reference in New Issue