Index: lams_central/conf/language/lams/ApplicationResources.properties
===================================================================
diff -u -r5cf9e6a0f2d86fd8371a466a07b8c0cbf3f81cb8 -rfd06ba812429b63a6dfcb0d8505800fe050fbfc9
--- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 5cf9e6a0f2d86fd8371a466a07b8c0cbf3f81cb8)
+++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision fd06ba812429b63a6dfcb0d8505800fe050fbfc9)
@@ -265,9 +265,21 @@
signup.confirm.email =Confirm email
signup.course.key =Course key
signup.submit =Submit
+signup.email.verify.subject =LAMS: confirm email address
+signup.email.verify.body =Hi there,
\
+Please confirm your email address by clicking on the link below
\
+{0}
\
+Regards,
\
+LAMS Signup System
signup.email.verify.sent =A confirmation email has been sent to {0}
Check your email and follow the instructions.
signup.email.verify.success =You email has been verified
signup.email.verify.fail =Your email could not be verified
+signup.email.welcome.subject =LAMS: account details
+signup.email.welcome.body =Hi there,
\
+You've successfully registered an account with username {0} on the LAMS server at {1}.
\
+If you ever forget your password, you can reset it via this URL
{1}/forgotPassword.jsp
\
+Regards
\
+LAMS Signup System
title.lams.signup =LAMS Signup
error.username.blank =Username cannot be blank
error.username.exists =Username is taken
Index: lams_central/src/java/org/lamsfoundation/lams/web/action/SignupAction.java
===================================================================
diff -u -r5cf9e6a0f2d86fd8371a466a07b8c0cbf3f81cb8 -rfd06ba812429b63a6dfcb0d8505800fe050fbfc9
--- lams_central/src/java/org/lamsfoundation/lams/web/action/SignupAction.java (.../SignupAction.java) (revision 5cf9e6a0f2d86fd8371a466a07b8c0cbf3f81cb8)
+++ lams_central/src/java/org/lamsfoundation/lams/web/action/SignupAction.java (.../SignupAction.java) (revision fd06ba812429b63a6dfcb0d8505800fe050fbfc9)
@@ -27,6 +27,7 @@
import org.lamsfoundation.lams.util.Emailer;
import org.lamsfoundation.lams.util.HashUtil;
import org.lamsfoundation.lams.util.LanguageUtil;
+import org.lamsfoundation.lams.util.MessageService;
import org.lamsfoundation.lams.util.ValidationUtil;
import org.lamsfoundation.lams.util.WebUtil;
import org.springframework.web.context.WebApplicationContext;
@@ -37,6 +38,7 @@
private static Logger log = Logger.getLogger(SignupAction.class);
private static ISignupService signupService = null;
private static ITimezoneService timezoneService = null;
+ private static MessageService messageService = null;
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
@@ -46,11 +48,12 @@
return emailVerify(mapping, form, request, response);
}
- if (signupService == null || timezoneService == null) {
+ if (signupService == null || timezoneService == null || messageService == null) {
WebApplicationContext wac = WebApplicationContextUtils
.getRequiredWebApplicationContext(getServlet().getServletContext());
signupService = (ISignupService) wac.getBean("signupService");
timezoneService = (ITimezoneService) wac.getBean("timezoneService");
+ messageService = (MessageService) wac.getBean("centralMessageService");
}
request.setAttribute("countryCodes", LanguageUtil.getCountryCodes(true));
@@ -140,16 +143,10 @@
}
private void sendWelcomeEmail(User user) throws AddressException, MessagingException, UnsupportedEncodingException {
- String subject = "LAMS: account details";
- String body = "Hi there,\n\n";
- body += "You've successfully registered an account with username " + user.getLogin();
- body += " on the LAMS server at " + Configuration.get(ConfigurationKeys.SERVER_URL);
- body += ". If you ever forget your password, you can reset it via this URL "
- + Configuration.get(ConfigurationKeys.SERVER_URL) + "/forgotPassword.jsp.";
- body += "\n\n";
- body += "Regards,\n";
- body += "LAMS Signup System";
- boolean isHtmlFormat = false;
+ String subject = messageService.getMessage("signup.email.welcome.subject");
+ String body = messageService.getMessage("signup.email.welcome.body",
+ new Object[] { user.getLogin(), Configuration.get(ConfigurationKeys.SERVER_URL) });
+ boolean isHtmlFormat = true;
Emailer.sendFromSupportEmail(subject, user.getEmail(), body, isHtmlFormat);
}
@@ -159,12 +156,8 @@
String hash = HashUtil.sha256(user.getEmail(), user.getSalt());
String link = Configuration.get(ConfigurationKeys.SERVER_URL) + "signup/signup.do?method=emailVerify&login="
+ URLEncoder.encode(user.getLogin(), "UTF-8") + "&hash=" + hash;
- String subject = "LAMS: confirm email address";
- String body = "Hi there,
";
- body += "Please confirm your email address by clicking on the link below
";
- body += "" + link + "
";
- body += "Regards,
";
- body += "LAMS Signup System";
+ String subject = messageService.getMessage("signup.email.verify.subject");
+ String body = messageService.getMessage("signup.email.verify.body", new Object[] { link });
boolean isHtmlFormat = true;
Emailer.sendFromSupportEmail(subject, user.getEmail(), body, isHtmlFormat);