i18n password changed.

This commit is contained in:
Paulo Gustavo Veiga 2022-03-27 14:29:29 -03:00
parent 8989914eb3
commit ff2b37f4cf
9 changed files with 162 additions and 138 deletions

View File

@ -48,7 +48,7 @@ public class RequestPropertiesInterceptor implements HandlerInterceptor {
@Value("${site.homepage}") @Value("${site.homepage}")
private String siteHomepage; private String siteHomepage;
@Value("${site.baseurl}") @Value("${site.baseurl:http://localhost:8080}")
private String siteUrl; private String siteUrl;
@Value("${security.type}") @Value("${security.type}")

View File

@ -23,7 +23,6 @@ import com.wisemapping.model.Collaboration;
import com.wisemapping.model.Mindmap; import com.wisemapping.model.Mindmap;
import com.wisemapping.model.User; import com.wisemapping.model.User;
import com.wisemapping.rest.model.RestLogItem; import com.wisemapping.rest.model.RestLogItem;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringEscapeUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -33,6 +32,7 @@ import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.context.support.ResourceBundleMessageSource; import org.springframework.context.support.ResourceBundleMessageSource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -43,8 +43,6 @@ import java.util.stream.Collectors;
final public class NotificationService { final public class NotificationService {
final private static Logger logger = Logger.getLogger(Mailer.class); final private static Logger logger = Logger.getLogger(Mailer.class);
final private static String DEFAULT_WISE_URL = "http://localhost:8080/wisemapping";
private ResourceBundleMessageSource messageSource; private ResourceBundleMessageSource messageSource;
@Autowired @Autowired
@ -83,22 +81,22 @@ final public class NotificationService {
} }
public void resetPassword(@NotNull User user, @NotNull String temporalPassword) { public void resetPassword(@NotNull User user, @NotNull String temporalPassword) {
final String mailSubject = "[WiseMapping] Your new password"; final Locale locale = LocaleContextHolder.getLocale();
final String messageTitle = "Your new password has been generated";
final String messageBody = final String mailSubject = messageSource.getMessage("CHANGE_PASSWORD.EMAIL_SUBJECT", null, locale);
"<p>Someone, most likely you, requested a new password for your WiseMapping account. </p>\n" + final String messageTitle = messageSource.getMessage("CHANGE_PASSWORD.EMAIL_TITLE", null, locale);
"<p><strong>Here is your new password: " + temporalPassword + "</strong></p>\n" + final String messageBody = messageSource.getMessage("CHANGE_PASSWORD.EMAIL_BODY", new Object[]{temporalPassword, getBaseUrl()}, locale);
"<p>You can login clicking <a href=\"" + getBaseUrl() + "/c/login\">here</a>. We strongly encourage you to change the password as soon as possible.</p>";
sendTemplateMail(user, mailSubject, messageTitle, messageBody); sendTemplateMail(user, mailSubject, messageTitle, messageBody);
} }
public void passwordChanged(@NotNull User user) { public void passwordChanged(@NotNull User user) {
final String mailSubject = "[WiseMapping] Your password has been changed"; final Locale locale = LocaleContextHolder.getLocale();
final String messageTitle = "Your password has been changed successfully";
final String messageBody = final String mailSubject = messageSource.getMessage("PASSWORD_CHANGED.EMAIL_SUBJECT", null, locale);
"<p>This is only an notification that your password has been changed. No further action is required.</p>"; final String messageTitle = messageSource.getMessage("PASSWORD_CHANGED.EMAIL_TITLE", null, locale);
final String messageBody = messageSource.getMessage("PASSWORD_CHANGED.EMAIL_BODY", null, locale);
sendTemplateMail(user, mailSubject, messageTitle, messageBody); sendTemplateMail(user, mailSubject, messageTitle, messageBody);
} }
@ -122,6 +120,7 @@ final public class NotificationService {
model.put("baseUrl", getBaseUrl()); model.put("baseUrl", getBaseUrl());
model.put("supportEmail", mailer.getSupportEmail()); model.put("supportEmail", mailer.getSupportEmail());
logger.debug("Email properties->" + model);
mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), mailSubject, model, "baseLayout.vm"); mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), mailSubject, model, "baseLayout.vm");
} catch (Exception e) { } catch (Exception e) {
handleException(e); handleException(e);
@ -205,26 +204,19 @@ final public class NotificationService {
} }
public String stackTraceToString(@NotNull Throwable e) { public String stackTraceToString(@NotNull Throwable e) {
String retValue; String retValue = "";
StringWriter sw = null; StringWriter sw = new StringWriter();
PrintWriter pw = null; PrintWriter pw = new PrintWriter(sw);
try { try (sw; pw) {
sw = new StringWriter();
pw = new PrintWriter(sw);
e.printStackTrace(pw); e.printStackTrace(pw);
retValue = sw.toString(); retValue = sw.toString();
} finally { } catch (IOException ioException) {
IOUtils.closeQuietly(pw); ioException.printStackTrace();
IOUtils.closeQuietly(sw);
} }
return retValue; return retValue;
} }
public String getBaseUrl() { public String getBaseUrl() {
if ("${site.baseurl}".equals(baseUrl)) {
baseUrl = DEFAULT_WISE_URL;
System.err.println("Warning: site.baseurl has not being configured. Mail site references could be not properly sent. Using :" + baseUrl);
}
return baseUrl; return baseUrl;
} }

View File

@ -51,7 +51,12 @@ TRY_WELCOME = Dieser Ausgabebereich zeigt einige der Mindmap-Editor-Funktionen \
UNEXPECTED_ERROR_DETAILS=Unerwarteter Fehler bei der Verarbeitung der Anforderung. UNEXPECTED_ERROR_DETAILS=Unerwarteter Fehler bei der Verarbeitung der Anforderung.
NO_ENOUGH_PERMISSIONS=Diese map ist nicht mehr verfügbar. NO_ENOUGH_PERMISSIONS=Diese map ist nicht mehr verfügbar.
NO_ENOUGH_PERMISSIONS_DETAILS=Sie haben nicht die erforderlichen Rechte, um sich diese map anzusehen. Diese map ist entweder privat oder wurde gelöscht. NO_ENOUGH_PERMISSIONS_DETAILS=Sie haben nicht die erforderlichen Rechte, um sich diese map anzusehen. Diese map ist entweder privat oder wurde gelöscht.
REGISTRATION.EMAIL_SUBJECT=Willkommen bei WiseMapping! REGISTRATION.EMAIL_SUBJECT=Willkommen bei WiseMapping!
REGISTRATION.EMAIL_TITLE=Ihr Konto wurde erfolgreich erstellt REGISTRATION.EMAIL_TITLE=Ihr Konto wurde erfolgreich erstellt
REGISTRATION.EMAIL_BODY=<p> Vielen Dank für Ihr Interesse an WiseMapping. Klicken Sie <a href='https://app.wisemapping.com/c/login'>hier</a>, um mit dem Erstellen und Teilen neuer Mindmaps zu beginnen. Wenn Sie Feedback oder Ideen haben, senden Sie uns eine E-Mail an <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a>. Wir würden uns freuen, von Ihnen zu hören.</p > REGISTRATION.EMAIL_BODY=<p> Vielen Dank für Ihr Interesse an WiseMapping. Klicken Sie <a href='https://app.wisemapping.com/c/login'>hier</a>, um mit dem Erstellen und Teilen neuer Mindmaps zu beginnen. Wenn Sie Feedback oder Ideen haben, senden Sie uns eine E-Mail an <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a>. Wir würden uns freuen, von Ihnen zu hören.</p >
CHANGE_PASSWORD.EMAIL_SUBJECT=Dein Passwort wurde zurück gesetzt
CHANGE_PASSWORD.EMAIL_TITLE=Ein temporäres Passwort wurde generiert
CHANGE_PASSWORD.EMAIL_BODY=<p>Jemand, höchstwahrscheinlich Sie selbst, hat ein neues Passwort für Ihr WiseMapping-Konto angefordert. </p><p><strong>Hier ist Ihr neues Passwort: {0} </strong></p><p>Sie können sich anmelden, indem Sie <a href='${1}/c/login'>hier klicken </a>. Wir empfehlen Ihnen dringend, das Passwort so schnell wie möglich zu ändern.</p>
PASSWORD_CHANGED.EMAIL_SUBJECT=Ihr Passwort wurde geändert
PASSWORD_CHANGED.EMAIL_TITLE=Ihr Passwort wurde erfolgreich geändert
PASSWORD_CHANGED.EMAIL_BODY=<p>Dies ist nur eine Benachrichtigung, dass Ihr Passwort geändert wurde. Es sind keine weiteren Maßnahmen erforderlich.</p>

View File

@ -61,3 +61,12 @@ TOO_BIG_MINDMAP=You have reached the limit of 500 topics in a mindmap.
REGISTRATION.EMAIL_SUBJECT=Welcome to WiseMapping ! REGISTRATION.EMAIL_SUBJECT=Welcome to WiseMapping !
REGISTRATION.EMAIL_TITLE=Your account has been created successfully REGISTRATION.EMAIL_TITLE=Your account has been created successfully
REGISTRATION.EMAIL_BODY=<p> Thank you for your interest in WiseMapping. Click <a href='https://app.wisemapping.com/c/login'>here</a> to start creating and sharing new mind maps. If have any feedback or idea, send us an email to <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a> .We'd love to hear from you.</p> REGISTRATION.EMAIL_BODY=<p> Thank you for your interest in WiseMapping. Click <a href='https://app.wisemapping.com/c/login'>here</a> to start creating and sharing new mind maps. If have any feedback or idea, send us an email to <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a> .We'd love to hear from you.</p>
CHANGE_PASSWORD.EMAIL_SUBJECT=Your password has been reset
CHANGE_PASSWORD.EMAIL_TITLE=A temporal password has been generated
CHANGE_PASSWORD.EMAIL_BODY=<p>Someone, most likely you, requested a new password for your WiseMapping account. </p><p><strong>Here is your new password: {0} </strong></p><p>You can login clicking <a href='${1}/c/login'>here</a>. We strongly encourage you to change the password as soon as possible.</p>
PASSWORD_CHANGED.EMAIL_SUBJECT=Your password has been changed
PASSWORD_CHANGED.EMAIL_TITLE=Your password has been changed successfully
PASSWORD_CHANGED.EMAIL_BODY=<p>This is only an notification that your password has been changed. No further action is required.</p>

View File

@ -56,3 +56,10 @@ REGISTRATION.EMAIL_SUBJECT=Bienvenido/a a WiseMapping !
REGISTRATION.EMAIL_TITLE=Tu cuenta ha sido creada exitosamente REGISTRATION.EMAIL_TITLE=Tu cuenta ha sido creada exitosamente
REGISTRATION.EMAIL_BODY=<p> Gracias por tu interest en WiseMapping. Hace click <a href='https://app.wisemapping.com/c/login'>aqui</a> para empezar a crear y compatir tus mapas mentales. Ideas y sugerencias, no dudes en contactarnos a <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a>.</p> REGISTRATION.EMAIL_BODY=<p> Gracias por tu interest en WiseMapping. Hace click <a href='https://app.wisemapping.com/c/login'>aqui</a> para empezar a crear y compatir tus mapas mentales. Ideas y sugerencias, no dudes en contactarnos a <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a>.</p>
CHANGE_PASSWORD.EMAIL_SUBJECT=Su contraseña ha sido restablecida
CHANGE_PASSWORD.EMAIL_TITLE=Se ha generado una contraseña temporal
CHANGE_PASSWORD.EMAIL_BODY=<p>Alguien, muy probablemente usted, solicitó una nueva contraseña para su cuenta de WiseMapping. </p><p><strong>Esta es su nueva contraseña: {0} </strong></p><p>Puede iniciar sesión haciendo clic <a href='${1}/c/login'>aquí </a>. Te recomendamos que cambie la contraseña lo antes posible.</p>
PASSWORD_CHANGED.EMAIL_SUBJECT=Su contraseña ha sido cambiada
PASSWORD_CHANGED.EMAIL_TITLE=Su contraseña ha sido cambiada con éxito
PASSWORD_CHANGED.EMAIL_BODY=<p>Esto es solo una notificación de que su contraseña ha sido cambiada. No se requiere ninguna otra acción.</p>

View File

@ -55,3 +55,11 @@ NO_ENOUGH_PERMISSIONS_DETAILS=Vous n'avez pas les droits d'accès suffisants pou
REGISTRATION.EMAIL_SUBJECT=Bienvenue sur WiseMapping ! REGISTRATION.EMAIL_SUBJECT=Bienvenue sur WiseMapping !
REGISTRATION.EMAIL_TITLE=Votre compte a été créé avec succès REGISTRATION.EMAIL_TITLE=Votre compte a été créé avec succès
REGISTRATION.EMAIL_BODY=<p> Merci de l'intérêt que vous portez à WiseMapping. Cliquez <a href='https://app.wisemapping.com/c/login'>ici</a> pour commencer à créer et partager de nouvelles cartes mentales. Si vous avez des commentaires ou des idées, envoyez-nous un e-mail à <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a>. Nous aimerions avoir de vos nouvelles.</p > REGISTRATION.EMAIL_BODY=<p> Merci de l'intérêt que vous portez à WiseMapping. Cliquez <a href='https://app.wisemapping.com/c/login'>ici</a> pour commencer à créer et partager de nouvelles cartes mentales. Si vous avez des commentaires ou des idées, envoyez-nous un e-mail à <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a>. Nous aimerions avoir de vos nouvelles.</p >
CHANGE_PASSWORD.EMAIL_SUBJECT=Votre mot de passe a été réinitialisé
CHANGE_PASSWORD.EMAIL_TITLE=Un mot de passe temporaire a été généré
CHANGE_PASSWORD.EMAIL_BODY=<p>Quelqu'un, probablement vous, a demandé un nouveau mot de passe pour votre compte WiseMapping. </p><p><strong>Voici votre nouveau mot de passe : {0} </strong></p><p>Vous pouvez vous connecter en cliquant sur <a href='${1}/c/login'> ici </a>. Nous vous recommandons de changer votre mot de passe dès que possible.</p>
PASSWORD_CHANGED.EMAIL_SUBJECT=Votre mot de passe a été changé
PASSWORD_CHANGED.EMAIL_TITLE=Votre mot de passe a été changé avec succès
PASSWORD_CHANGED.EMAIL_BODY=<p>Il s'agit simplement d'une notification indiquant que votre mot de passe a été modifié. Aucune autre action n'est requise.</p>

View File

@ -56,7 +56,12 @@ CAPTCHA_INVALID_INPUT_RESPONSE=输入无效,刷新页面后重试。
MINDMAP_EMPTY_ERROR=思维导图不能为空。 MINDMAP_EMPTY_ERROR=思维导图不能为空。
INVALID_MINDMAP_FORMAT=思维导图格式无效。 INVALID_MINDMAP_FORMAT=思维导图格式无效。
TOO_BIG_MINDMAP=你已经达到了一张思维导图中500个主题的限制。 TOO_BIG_MINDMAP=你已经达到了一张思维导图中500个主题的限制。
REGISTRATION.EMAIL_SUBJECT=欢迎来到智慧地图 REGISTRATION.EMAIL_SUBJECT=欢迎来到智慧地图
REGISTRATION.EMAIL_TITLE=您的帐户已成功创建 REGISTRATION.EMAIL_TITLE=您的帐户已成功创建
REGISTRATION.EMAIL_BODY=<p> 感谢您对 WiseMapping 的关注。点击<a href='https://app.wisemapping.com/c/login'>这里</a>开始创建和分享新的思维导图。如果有任何反馈或想法,请给我们发送电子邮件至 <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a>。我们很乐意听取您的意见。</p > REGISTRATION.EMAIL_BODY=<p> 感谢您对 WiseMapping 的关注。点击<a href='https://app.wisemapping.com/c/login'>这里</a>开始创建和分享新的思维导图。如果有任何反馈或想法,请给我们发送电子邮件至 <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a>。我们很乐意听取您的意见。</p >
CHANGE_PASSWORD.EMAIL_SUBJECT=您的密码已重置
CHANGE_PASSWORD.EMAIL_TITLE=已生成临时密码
CHANGE_PASSWORD.EMAIL_BODY=<p>有人(很可能是您)为您的 WiseMapping 帐户申请了新密码。 </p><p><strong>这是您的新密码:{0} </strong></p><p>您可以点击<a href='${1}/c/login'>此处登录</a>。我们强烈建议您尽快更改密码</p>
PASSWORD_CHANGED.EMAIL_SUBJECT=您的密码已被更改
PASSWORD_CHANGED.EMAIL_TITLE=你已经成功更改密码
PASSWORD_CHANGED.EMAIL_BODY=<p>这只是您的密码已更改的通知。无需进一步操作。</p>

View File

@ -89,9 +89,7 @@ google.recaptcha2.secretKey = 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
admin.user = admin@wisemapping.org admin.user = admin@wisemapping.org
# Base URL where WiseMapping is deployed. By default, It will be automatically inferred. # Base URL where WiseMapping is deployed. By default, It will be automatically inferred.
# If you are planning to put wisemapping behind an Apache using an Apache Proxy setup, you must enable this property. site.baseurl = http://localhost:8080
#site.baseurl = http://example.com:8080/wisemapping
# Site Homepage URL. This will be used as URL for homepage location. # Site Homepage URL. This will be used as URL for homepage location.
site.homepage = c/login site.homepage = c/login

View File

@ -82,9 +82,9 @@
<property name="password" value="${mail.password}"/> <property name="password" value="${mail.password}"/>
<property name="javaMailProperties"> <property name="javaMailProperties">
<props> <props>
<prop key="mail.smtp.auth">${mail.smtp.auth}</prop> <prop key="mail.smtp.auth">${mail.smtp.auth:false}</prop>
<prop key="mail.smtp.starttls.enable">${mail.smtp.starttls.enable}</prop> <prop key="mail.smtp.starttls.enable">${mail.smtp.starttls.enable:false}</prop>
<prop key="mail.smtp.quitwait">${mail.smtp.quitwait}</prop> <prop key="mail.smtp.quitwait">${mail.smtp.quitwait:true}</prop>
</props> </props>
</property> </property>
</bean> </bean>
@ -93,7 +93,7 @@
</bean> </bean>
<bean id="notificationService" class="com.wisemapping.mail.NotificationService"> <bean id="notificationService" class="com.wisemapping.mail.NotificationService">
<property name="baseUrl" value="${site.baseurl}"/> <property name="baseUrl" value="${site.baseurl:http://localhost:8080/}"/>
<property name="mailer" ref="mailer"/> <property name="mailer" ref="mailer"/>
<property name="messageSource" ref="messageSource"/> <property name="messageSource" ref="messageSource"/>
</bean> </bean>