Customizable From header

Signed-off-by: Bernardus Jansen <bernardus@bajansen.nl>
master
Bernardus Jansen 9 years ago
parent 6bf5bebecd
commit 134faf33d2
  1. 9
      libresonic-main/src/main/java/org/libresonic/player/command/AdvancedSettingsCommand.java
  2. 2
      libresonic-main/src/main/java/org/libresonic/player/controller/AdvancedSettingsController.java
  3. 2
      libresonic-main/src/main/java/org/libresonic/player/controller/MultiController.java
  4. 10
      libresonic-main/src/main/java/org/libresonic/player/service/SettingsService.java
  5. 11
      libresonic-main/src/main/resources/org/libresonic/player/i18n/ResourceBundle_en.properties
  6. 3
      libresonic-main/src/main/resources/org/libresonic/player/i18n/ResourceBundle_nl.properties
  7. 25
      libresonic-main/src/main/webapp/WEB-INF/jsp/advancedSettings.jsp

@ -45,6 +45,7 @@ public class AdvancedSettingsCommand {
private String smtpPort; private String smtpPort;
private String smtpUser; private String smtpUser;
private String smtpPassword; private String smtpPassword;
private String smtpFrom;
public String getDownloadLimit() { public String getDownloadLimit() {
return downloadLimit; return downloadLimit;
@ -173,4 +174,12 @@ public class AdvancedSettingsCommand {
public void setSmtpPassword(String smtpPassword) { public void setSmtpPassword(String smtpPassword) {
this.smtpPassword = smtpPassword; this.smtpPassword = smtpPassword;
} }
public String getSmtpFrom() {
return smtpFrom;
}
public void setSmtpFrom(String smtpFrom) {
this.smtpFrom = smtpFrom;
}
} }

@ -51,6 +51,7 @@ public class AdvancedSettingsController extends SimpleFormController {
command.setSmtpEncryption(settingsService.getSmtpEncryption()); command.setSmtpEncryption(settingsService.getSmtpEncryption());
command.setSmtpPort(settingsService.getSmtpPort()); command.setSmtpPort(settingsService.getSmtpPort());
command.setSmtpUser(settingsService.getSmtpUser()); command.setSmtpUser(settingsService.getSmtpUser());
command.setSmtpFrom(settingsService.getSmtpFrom());
return command; return command;
} }
@ -83,6 +84,7 @@ public class AdvancedSettingsController extends SimpleFormController {
settingsService.setSmtpEncryption(command.getSmtpEncryption()); settingsService.setSmtpEncryption(command.getSmtpEncryption());
settingsService.setSmtpPort(command.getSmtpPort()); settingsService.setSmtpPort(command.getSmtpPort());
settingsService.setSmtpUser(command.getSmtpUser()); settingsService.setSmtpUser(command.getSmtpUser());
settingsService.setSmtpFrom(command.getSmtpFrom());
if (StringUtils.isNotEmpty(command.getSmtpPassword())) { if (StringUtils.isNotEmpty(command.getSmtpPassword())) {
settingsService.setSmtpPassword(command.getSmtpPassword()); settingsService.setSmtpPassword(command.getSmtpPassword());

@ -168,7 +168,7 @@ public class MultiController extends MultiActionController {
try { try {
Message message = new MimeMessage(session); Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("libresonic@libresonic.org")); message.setFrom(new InternetAddress(settingsService.getSmtpFrom()));
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(email)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(email));
message.setSubject("Libresonic Password"); message.setSubject("Libresonic Password");
message.setText("Hi there!\n\n" + message.setText("Hi there!\n\n" +

@ -149,6 +149,7 @@ public class SettingsService {
private static final String KEY_SMTP_PORT = "SmtpPort"; private static final String KEY_SMTP_PORT = "SmtpPort";
private static final String KEY_SMTP_USER = "SmtpUser"; private static final String KEY_SMTP_USER = "SmtpUser";
private static final String KEY_SMTP_PASSWORD = "SmtpPassword"; private static final String KEY_SMTP_PASSWORD = "SmtpPassword";
private static final String KEY_SMTP_FROM = "SmtpFrom";
// Default values. // Default values.
private static final String DEFAULT_INDEX_STRING = "A B C D E F G H I J K L M N O P Q R S T U V W X-Z(XYZ)"; private static final String DEFAULT_INDEX_STRING = "A B C D E F G H I J K L M N O P Q R S T U V W X-Z(XYZ)";
@ -223,6 +224,7 @@ public class SettingsService {
private static final String DEFAULT_SMTP_PORT = "25"; private static final String DEFAULT_SMTP_PORT = "25";
private static final String DEFAULT_SMTP_USER = null; private static final String DEFAULT_SMTP_USER = null;
private static final String DEFAULT_SMTP_PASSWORD = null; private static final String DEFAULT_SMTP_PASSWORD = null;
private static final String DEFAULT_SMTP_FROM = "libresonic@libresonic.org";
// Array of obsolete keys. Used to clean property file. // Array of obsolete keys. Used to clean property file.
private static final List<String> OBSOLETE_KEYS = Arrays.asList("PortForwardingPublicPort", "PortForwardingLocalPort", private static final List<String> OBSOLETE_KEYS = Arrays.asList("PortForwardingPublicPort", "PortForwardingLocalPort",
@ -1508,4 +1510,12 @@ public class SettingsService {
} }
properties.setProperty(KEY_SMTP_PASSWORD, smtpPassword); properties.setProperty(KEY_SMTP_PASSWORD, smtpPassword);
} }
public String getSmtpFrom() {
return properties.getProperty(KEY_SMTP_FROM, DEFAULT_SMTP_FROM);
}
public void setSmtpFrom(String smtpFrom) {
setString(KEY_SMTP_FROM, smtpFrom);
}
} }

@ -343,12 +343,13 @@ advancedsettings.ldapmanagerpassword = Password
advancedsettings.ldapautoshadowing = Automatically create users in {0} advancedsettings.ldapautoshadowing = Automatically create users in {0}
advancedsettings.smtpPort = SMTP port advancedsettings.smtpPort = SMTP port
advancedsettings.smtpServer = SMTP server advancedsettings.smtpServer = SMTP server
advancedsettings.smtpEncryption = SMTP encryption method advancedsettings.smtpEncryption = SMTP encryption
advancedsettings.smtpUser = SMTP username advancedsettings.smtpUser = SMTP username
advancedsettings.smtpPassword = SMTP password advancedsettings.smtpPassword = Password
advancedsettings.smtpEncryption.none = None advancedsettings.smtpEncryption.none = None
advancedsettings.smtpEncryption.starttls = STARTTLS advancedsettings.smtpEncryption.starttls = STARTTLS
advancedsettings.smtpEncryption.ssl = SSL/TLS advancedsettings.smtpEncryption.ssl = SSL/TLS
advancedsettings.smtpFrom = Mail sender
# personalSettings.jsp # personalSettings.jsp
personalsettings.title = Personal settings for {0} personalsettings.title = Personal settings for {0}
@ -821,10 +822,12 @@ helppopup.smtpServer.text = <p>The hostname of the SMTP server. This server will
who have requested a password reset.</p> who have requested a password reset.</p>
helppopup.smtpPort.title = SMTP Port helppopup.smtpPort.title = SMTP Port
helppopup.smtpPort.text = <p>The server's port that should be connected to for SMTP traffic.</p> helppopup.smtpPort.text = <p>The server's port that should be connected to for SMTP traffic.</p>
helppopup.smtpUser.title = SMTP User helppopup.smtpCredentials.title = SMTP Credentials
helppopup.smtpUser.text = <p>The username to be used to authenticate with the server. Leave empty to connect without authentication.</p> helppopup.smtpCredentials.text = <p>The credentials to be used to connect to the SMTP server. Leave empty to connect without authentication.</p>
helppopup.smtpEncryption.title = SMTP Encryption helppopup.smtpEncryption.title = SMTP Encryption
helppopup.smtpEncryption.text = <p>The encryption method to be used to connect to the SMTP server. Choose "None" for no encryption.</p> helppopup.smtpEncryption.text = <p>The encryption method to be used to connect to the SMTP server. Choose "None" for no encryption.</p>
helppopup.smtpFrom.title = From address
helppopup.smtpFrom.text = <p>The sender address for mails originating from the Libresonic server. Must be a valid e-mail address.</p>
# wap/index.jsp # wap/index.jsp
wap.index.missing = No music found wap.index.missing = No music found

@ -343,8 +343,9 @@ advancedsettings.smtpPort = SMTP poort
advancedsettings.smtpServer = SMTP server advancedsettings.smtpServer = SMTP server
advancedsettings.smtpEncryption = SMTP versleutelingsmethode advancedsettings.smtpEncryption = SMTP versleutelingsmethode
advancedsettings.smtpUser = SMTP gebruikersnaam advancedsettings.smtpUser = SMTP gebruikersnaam
advancedsettings.smtpPassword = SMTP wachtwoord advancedsettings.smtpPassword = Wachtwoord
advancedsettings.smtpEncryption.none = Geen advancedsettings.smtpEncryption.none = Geen
advancedsettings.smtpFrom = Afzender
# personalsettings.jsp # personalsettings.jsp
personalsettings.title = Persoonlijke instellingen voor {0} personalsettings.title = Persoonlijke instellingen voor {0}

@ -41,7 +41,15 @@
</tr> </tr>
</table> </table>
<table style="white-space:nowrap" class="indent"> <table class="indent">
<tr>
<td><fmt:message key="advancedsettings.smtpFrom"/></td>
<td>
<form:input path="smtpFrom" size="50"/>
<c:import url="helpToolTip.jsp"><c:param name="topic" value="smtpFrom"/></c:import>
</td>
</tr>
<tr> <tr>
<td><fmt:message key="advancedsettings.smtpServer"/></td> <td><fmt:message key="advancedsettings.smtpServer"/></td>
<td> <td>
@ -61,7 +69,7 @@
<tr> <tr>
<td><fmt:message key="advancedsettings.smtpEncryption"/></td> <td><fmt:message key="advancedsettings.smtpEncryption"/></td>
<td> <td>
<form:select path="smtpEncryption" cssStyle="width:20em"> <form:select path="smtpEncryption" cssStyle="width:8em">
<fmt:message key="advancedsettings.smtpEncryption.none" var="none"/> <fmt:message key="advancedsettings.smtpEncryption.none" var="none"/>
<fmt:message key="advancedsettings.smtpEncryption.starttls" var="starttls"/> <fmt:message key="advancedsettings.smtpEncryption.starttls" var="starttls"/>
<fmt:message key="advancedsettings.smtpEncryption.ssl" var="ssl"/> <fmt:message key="advancedsettings.smtpEncryption.ssl" var="ssl"/>
@ -77,15 +85,10 @@
<tr> <tr>
<td><fmt:message key="advancedsettings.smtpUser"/></td> <td><fmt:message key="advancedsettings.smtpUser"/></td>
<td> <td>
<form:input path="smtpUser" size="40"/> <form:input path="smtpUser" size="20"/>
<c:import url="helpToolTip.jsp"><c:param name="topic" value="smtpUser"/></c:import> <fmt:message key="advancedsettings.smtpPassword"/>
</td> <form:password path="smtpPassword" size="20"/>
</tr> <c:import url="helpToolTip.jsp"><c:param name="topic" value="smtpCredentials"/></c:import>
<tr>
<td><fmt:message key="advancedsettings.smtpPassword"/></td>
<td>
<form:password path="smtpPassword" size="40"/>
</td> </td>
</tr> </tr>

Loading…
Cancel
Save