Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
Niclas Thobaben | 18e99bce54 | |
Niclas Thobaben | 9efd92f844 | |
Niclas Thobaben | dd23dfca8e | |
Niclas Thobaben | 74f4e9b2d8 | |
Niclas Thobaben | 1d9f6d4470 | |
Niclas Thobaben | 461a70b91f |
|
@ -11,7 +11,7 @@ pipeline {
|
|||
DOCKER_GROUP = 'nclazz-service'
|
||||
DOCKER_IMAGE = 'mail-relay'
|
||||
DOCKER_TAG = "${ BRANCH_NAME == "master" ? "latest" : "develop" }"
|
||||
DOCKER_VERSION = "0.0.1-SNAPSHOT"
|
||||
DOCKER_VERSION = "1.0.0"
|
||||
|
||||
DEPLOY_ENV = "${ BRANCH_NAME == "master" ? "production" : "staging" }"
|
||||
}
|
||||
|
@ -91,7 +91,6 @@ pipeline {
|
|||
allOf {
|
||||
anyOf {
|
||||
branch 'master'
|
||||
branch 'develop'
|
||||
expression { return params.RUN_DEPLOYMENT }
|
||||
}
|
||||
}
|
||||
|
|
13
pom.xml
13
pom.xml
|
@ -1,24 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.6.3</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
<relativePath /> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<groupId>de.nclazz.service</groupId>
|
||||
<artifactId>mail-relay</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.0.1</version>
|
||||
<name>mail-relay</name>
|
||||
<description>Service for relaying mails from other services or static sites</description>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:https://git.l--n.de/nclazz/nclazz-mail-relay</connection>
|
||||
</scm>
|
||||
<tag>v1.0.0</tag>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<java.version>11</java.version>
|
||||
|
@ -309,7 +308,7 @@
|
|||
<requireJavaVersion>
|
||||
<version>11</version>
|
||||
</requireJavaVersion>
|
||||
<banDuplicatePomDependencyVersions/>
|
||||
<banDuplicatePomDependencyVersions />
|
||||
</rules>
|
||||
</configuration>
|
||||
<executions>
|
||||
|
|
|
@ -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