Skip to content

Commit

Permalink
send email if registration was successful
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwechner committed Jan 24, 2012
1 parent e07bb5f commit 959db25
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -49,6 +49,8 @@ public class UserRegistrationResource extends BasicXMLResource {
private static String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ";

private static final long DEFAULT_TOTAL_VALID_HRS = 24L;

private static final String FROM_ADDRESS = "no-reply@wyona.com";

/**
* @see org.wyona.yanel.impl.resources.BasicXMLResource#getContentXML(String)
Expand Down Expand Up @@ -227,8 +229,7 @@ private void sendConfirmationLinkEmail(Document doc, String uuid, String firstam
Element rootElement = doc.getDocumentElement();

try {
String from = "no-reply@wyona.com";
MailUtil.send(from, email, "Activate User Registration", getActivationURL() + "?uuid=" + uuid);
MailUtil.send(FROM_ADDRESS, email, "Activate User Registration", getActivationURL() + "?uuid=" + uuid);
Element element = (Element) rootElement.appendChild(doc.createElementNS(NAMESPACE, "confirmation-link-email-sent"));
element.setAttribute("hours-valid", "" + DEFAULT_TOTAL_VALID_HRS);
} catch(Exception e) {
Expand Down Expand Up @@ -570,6 +571,8 @@ private boolean activateRegistration(String uuid, Document doc) {
registerUser(doc, urBean.getFirstname(), urBean.getLastname(), urBean.getEmail(), urBean.getPassword());
getRealm().getRepository().getNode(path).delete();

MailUtil.send(FROM_ADDRESS, urBean.getEmail(), "User Registration Successful", getActivationURL().replace("registration", "index"));

Element rootElement = doc.getDocumentElement();
// TODO: Add gender/salutation
Element emailE = (Element) rootElement.appendChild(doc.createElementNS(NAMESPACE, "email"));
Expand Down

0 comments on commit 959db25

Please sign in to comment.