Commit 04526e0f by Nilu

C002.5 - Sign in - Email-based - Content - Email message for account creation

parent 29b37d0c
...@@ -176,7 +176,7 @@ public class SendVerificationMailFP extends SaveFP ...@@ -176,7 +176,7 @@ public class SendVerificationMailFP extends SaveFP
+ "&aid=" + candidate.getID() + "&aid=" + candidate.getID()
+ "&pin=" + candidate.getVerificationKey(); + "&pin=" + candidate.getVerificationKey();
Map defaultParams = CollectionUtils.mapEntry("link", link).toMap(); Map defaultParams = CollectionUtils.mapEntry("link", link).toMap();
ObjectTransform transform = Utils.createCompoundTransform(defaultParams, candidate); ObjectTransform transform = Utils.createCompoundTransform(defaultParams, candidate.getUser());
Utils.sendMail(emailer, transform, new String[]{candidate.getUser().getUserName()}, null, candidate); Utils.sendMail(emailer, transform, new String[]{candidate.getUser().getUserName()}, null, candidate);
......
...@@ -2,10 +2,12 @@ package performa.form; ...@@ -2,10 +2,12 @@ package performa.form;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import oneit.business.content.Article;
import oneit.components.ParticipantInitialisationContext; import oneit.components.ParticipantInitialisationContext;
import oneit.email.ConfigurableArticleTemplateEmailer; import oneit.email.ConfigurableArticleTemplateEmailer;
import oneit.email.ConfigurableEmailerException; import oneit.email.ConfigurableEmailerException;
import oneit.logging.*; import oneit.logging.*;
import oneit.net.LoopbackHTTP;
import oneit.objstore.StorageException; import oneit.objstore.StorageException;
import oneit.objstore.parser.BusinessObjectParser; import oneit.objstore.parser.BusinessObjectParser;
import oneit.security.SecUser; import oneit.security.SecUser;
...@@ -16,6 +18,7 @@ import oneit.utils.*; ...@@ -16,6 +18,7 @@ import oneit.utils.*;
import performa.intercom.utils.IntercomUtils; import performa.intercom.utils.IntercomUtils;
import performa.orm.*; import performa.orm.*;
import performa.utils.Utils; import performa.utils.Utils;
import performa.utils.WebUtils;
public class VerifyIdentityFP extends SaveFP public class VerifyIdentityFP extends SaveFP
...@@ -73,7 +76,7 @@ public class VerifyIdentityFP extends SaveFP ...@@ -73,7 +76,7 @@ public class VerifyIdentityFP extends SaveFP
// secUser.setAttribute("md5:" + SecUser.FIELD_Password, job.getPassword()); // secUser.setAttribute("md5:" + SecUser.FIELD_Password, job.getPassword());
candidate.setIsAccountVerified(Boolean.TRUE); candidate.setIsAccountVerified(Boolean.TRUE);
sendMail(candidate, request); sendMail(candidate, job, request);
// Create a applicant user in intercom // Create a applicant user in intercom
IntercomUtils.createIntercomUser(secUser, "Applicant", null); IntercomUtils.createIntercomUser(secUser, "Applicant", null);
...@@ -97,18 +100,23 @@ public class VerifyIdentityFP extends SaveFP ...@@ -97,18 +100,23 @@ public class VerifyIdentityFP extends SaveFP
{ {
super.init(context); super.init(context);
emailer = (ConfigurableArticleTemplateEmailer) (context.getSingleChild("AccountCreatedEmailer")); emailer = (ConfigurableArticleTemplateEmailer) (context.getSingleChild("ApplicantAccountCreatedEmailer"));
} }
protected void sendMail(Candidate candidate, HttpServletRequest request) throws BusinessException protected void sendMail(Candidate candidate, Job job, HttpServletRequest request) throws BusinessException
{ {
try try
{ {
LogMgr.log(LOG, LogLevel.PROCESSING1, "Sending Account Created mail from VerifyIdentityFP to :: ", candidate); LogMgr.log(LOG, LogLevel.PROCESSING1, "Sending Account Created mail from VerifyIdentityFP to :: ", candidate);
Map defaultParams = CollectionUtils.EMPTY_MAP; Article applyJobArticle = WebUtils.getArticleByShortCut(candidate.getTransaction(), WebUtils.APPLY_JOB);
ObjectTransform transform = Utils.createCompoundTransform(defaultParams, candidate); String link = LoopbackHTTP.getRemoteAccessURL(request)
+ applyJobArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", WebUtils.FORGOT_PASSWORD).toMap(), "/")
+ "&id=" + job.getID()
+ "&key=" + job.getRandomKey();
Map defaultParams = CollectionUtils.mapEntry("link", link).toMap();
ObjectTransform transform = Utils.createCompoundTransform(defaultParams, candidate.getUser());
Utils.sendMail(emailer, transform, new String[]{candidate.getUser().getUserName()}, null, candidate); Utils.sendMail(emailer, transform, new String[]{candidate.getUser().getUserName()}, null, candidate);
......
...@@ -47,6 +47,7 @@ public class WebUtils ...@@ -47,6 +47,7 @@ public class WebUtils
public static final String RESET_PASSWORD = "ResetPassword"; public static final String RESET_PASSWORD = "ResetPassword";
public static final String COMPANY_PROFILE = "CompanyProfile"; public static final String COMPANY_PROFILE = "CompanyProfile";
public static final String INVITE_USERS = "InviteUsers"; public static final String INVITE_USERS = "InviteUsers";
public static final String FORGOT_PASSWORD = "ForgotPassword";
public static String getArticleLink(HttpServletRequest request, ObjectTransaction objTran, String articleShortcut, String renderMode) public static String getArticleLink(HttpServletRequest request, ObjectTransaction objTran, String articleShortcut, String renderMode)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<NODE name="dynamic_content_form::APPLICANT_PORTAL" factory="Participant"> <NODE name="dynamic_content_form::APPLICANT_PORTAL" factory="Participant">
<FORM name="*.signIn" factory="Participant" class="performa.form.SignInCandidateFP"/> <FORM name="*.signIn" factory="Participant" class="performa.form.SignInCandidateFP"/>
<FORM name="*.verifyIdentity" factory="Participant" class="performa.form.VerifyIdentityFP"> <FORM name="*.verifyIdentity" factory="Participant" class="performa.form.VerifyIdentityFP">
<AccountCreatedEmailer factory="Participant" class="oneit.email.ConfigurableArticleTemplateEmailer" templateShortcut="AccountCreatedMail"/> <ApplicantAccountCreatedEmailer factory="Participant" class="oneit.email.ConfigurableArticleTemplateEmailer" templateShortcut="ApplicantAccountCreatedMail"/>
</FORM> </FORM>
<FORM name="*.completeApplication" factory="Participant" class="performa.form.CompleteApplicationFP"/> <FORM name="*.completeApplication" factory="Participant" class="performa.form.CompleteApplicationFP"/>
<FORM name="*.saveAndExitExperienece" factory="Participant" class="performa.form.SaveAndExitExperienceFP"/> <FORM name="*.saveAndExitExperienece" factory="Participant" class="performa.form.SaveAndExitExperienceFP"/>
......
...@@ -42,9 +42,19 @@ ...@@ -42,9 +42,19 @@
} }
</style> </style>
<% <%
ORMProcessState process = (ORMProcessState) ProcessDecorator.getDefaultProcess(request); ORMProcessState process = (ORMProcessState) ProcessDecorator.getDefaultProcess(request);
ObjectTransaction objTran = process.getTransaction (); ObjectTransaction objTran = process.getTransaction ();
Job job = (Job) process.getAttribute("Job"); Job job = (Job) process.getAttribute("Job");
String id = request.getParameter("id");
String key = request.getParameter("key");
if(id != null && key != null)
{
job = Job.searchJobKey(objTran, Long.parseLong(id), key);
process.setAttribute("Job", job);
}
Debug.assertion(job != null, "Invalid job in applicant portal");
%> %>
<div class="main-verify-identity"> <div class="main-verify-identity">
<div class="login-logo"><img src="<%= request.getContextPath() %>/images/logo.svg" /></div> <div class="login-logo"><img src="<%= request.getContextPath() %>/images/logo.svg" /></div>
......
<?xml version="1.0" encoding="UTF-8"?>
<OBJECTS xmlns:oneit="http://www.1iT.com.au" name="">
<NODE factory="Vector" name="Script">
<NODE class="oneit.appservices.upgrade.cms.CMSArticleUpdateOperation" factory="Participant" name="Applicant Account Created Mail">
<createSpecificIdentifier factory='String' value='0QBF1OPIDVFDHJVKG22GUAY0OXAXPP'/>
<articleIdentifiers factory="Array" class="java.lang.String">
<NODE factory="String" value="0QBF1OPIDVFDHJVKG22GUAY0OXAXPP"/>
</articleIdentifiers>
<createdLabel factory="String" value="0QBF1OPIDVFDHJVKG22GUAY0OXAXPP"/>
<newParentCategory factory="String" value="RESOURCE_LIBRARY"/>
<articleAttributeChanges factory="Map">
<NODE name="EmailTo" factory="Null"/>
<NODE name="EmailFrom" factory="String" value="help@talentology.com"/>
<NODE name="EmailSubject" factory="String" value="Welcome to Talentology!"/>
<NODE name="Shortcuts" factory="String" value="ApplicantAccountCreatedMail"/>
<NODE name="EmailCC" factory="Null"/>
<NODE name="EmailBCC" factory="Null"/>
</articleAttributeChanges>
<ormAttributeChanges factory="Map">
<NODE name="PublishDate" factory="Date" value="2016-02-05 00:00:00"/>
<NODE name="WithdrawDate" factory="Date" value="2066-02-05 16:00:00"/>
<NODE name="Title" factory="String" value="Applicant Account Created Mail"/>
<NODE name="ShortTitle" factory="String" value="Reset Code Email"/>
<NODE name="SortOrder" factory="Integer" value="-200926"/>
<NODE name="Type" factory="Enumerated" class="oneit.business.content.ArticleType" value="ARTICLE"/>
<NODE name="Template" factory="Enumerated" class="oneit.business.content.ArticleTemplate" value="EMAIL_TEMPLATE"/>
</ormAttributeChanges>
<content factory="Map">
<NODE name="EmailBody" factory="Map">
<NODE name="Content" factory="String"><![CDATA[<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="HTML Tidy, see www.w3.org" name="generator">
<title></title>
</head>
<body>
<p>Hi ${SecUser:FirstName},</p>
<p>Welcome! You&rsquo;re now ready to apply for job opportunities that are powered by Talentology!</p>
<p>Your account&rsquo;s been set up and you&rsquo;re all ready to go. Whenever you sign in to Talentology, be sure to use <strong>${SecUser:UserName}</strong> along with the password that you just created.</p>
<p>And don&rsquo;t worry: If you ever forget your password, you can <a href="${link}">reset it</a> anytime.</p>
<p>Thanks,</p>
<p>The Talentology Team</p>
</body>
</html>
]]></NODE>
<NODE name="TransformedContent" factory="String"><![CDATA[<p>Hi ${SecUser:FirstName},</p><p>Welcome! You&rsquo;re now ready to apply for job opportunities that are powered by Talentology!</p><p>Your account&rsquo;s been set up and you&rsquo;re all ready to go. Whenever you sign in to Talentology, be sure to use <strong>${SecUser:UserName}</strong> along with the password that you just created.</p><p>And don&rsquo;t worry: If you ever forget your password, you can <a href="${link}">reset it</a> anytime.</p><p>Thanks,</p><p>The Talentology Team</p>
]]></NODE>
<NODE name="IncludeContent" factory="Boolean" value="true"/>
</NODE>
<NODE name="" factory="Map">
<NODE name="Content" factory="String"><![CDATA[
<p></p>
]]></NODE>
<NODE name="IncludeContent" factory="Boolean" value="true"/>
</NODE>
</content>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS xmlns:oneit="http://www.1iT.com.au" name="">
<NODE factory="Vector" name="Script">
<NODE class="oneit.appservices.upgrade.cms.CMSArticleUpdateOperation" factory="Participant" name="Account Verification Mail">
<createSpecificIdentifier factory='String' value='I90Q26LQURCWXZZFP21EWM3EHUGXTJ'/>
<articleIdentifiers factory="Array" class="java.lang.String">
<NODE factory="String" value="I90Q26LQURCWXZZFP21EWM3EHUGXTJ"/>
</articleIdentifiers>
<createdLabel factory="String" value="I90Q26LQURCWXZZFP21EWM3EHUGXTJ"/>
<newParentCategory factory="String" value="RESOURCE_LIBRARY"/>
<articleAttributeChanges factory="Map">
<NODE name="EmailTo" factory="Null"/>
<NODE name="EmailFrom" factory="String" value="help@talentology.com"/>
<NODE name="EmailSubject" factory="String" value="Please verify your email address"/>
<NODE name="Shortcuts" factory="String" value="AccountVerificationMail"/>
<NODE name="EmailCC" factory="Null"/>
<NODE name="EmailBCC" factory="Null"/>
</articleAttributeChanges>
<ormAttributeChanges factory="Map">
<NODE name="PublishDate" factory="Date" value="2016-02-05 00:00:00"/>
<NODE name="WithdrawDate" factory="Date" value="2066-02-05 16:00:00"/>
<NODE name="Title" factory="String" value="Account Verification Mail"/>
<NODE name="ShortTitle" factory="String" value="Reset Code Email"/>
<NODE name="SortOrder" factory="Integer" value="-200926"/>
<NODE name="Type" factory="Enumerated" class="oneit.business.content.ArticleType" value="ARTICLE"/>
<NODE name="Template" factory="Enumerated" class="oneit.business.content.ArticleTemplate" value="EMAIL_TEMPLATE"/>
</ormAttributeChanges>
<content factory="Map">
<NODE name="EmailBody" factory="Map">
<NODE name="Content" factory="String"><![CDATA[<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="HTML Tidy, see www.w3.org" name="generator">
<title></title>
</head>
<body>
<p>Hi,</p>
<p>You entered <strong>${SecUser:UserName}</strong> as your email address for your Talentology account.<br>Please verify this email address by clicking this link:</p>
<p>
<a href="${link}">Verify now</a>
</p>
<p>Thanks,</p>
<p>The Talentology Team</p>
</body>
</html>
]]></NODE>
<NODE name="TransformedContent" factory="String"><![CDATA[<p>Hi,</p><p>You entered <strong>${SecUser:UserName}</strong> as your email address for your Talentology account.<br>Please verify this email address by clicking this link:</p><p>
<a href="${link}">Verify now</a>
</p><p>Thanks,</p><p>The Talentology Team</p>
]]></NODE>
<NODE name="IncludeContent" factory="Boolean" value="true"/>
</NODE>
<NODE name="" factory="Map">
<NODE name="Content" factory="String"><![CDATA[
<p></p>
]]></NODE>
<NODE name="IncludeContent" factory="Boolean" value="true"/>
</NODE>
<NODE name="" factory="Map">
<NODE name="Content" factory="String"><![CDATA[
<p></p>
]]></NODE>
<NODE name="IncludeContent" factory="Boolean" value="true"/>
</NODE>
<NODE name="" factory="Map">
<NODE name="Content" factory="String"><![CDATA[
<p></p>
]]></NODE>
<NODE name="IncludeContent" factory="Boolean" value="true"/>
</NODE>
<NODE name="" factory="Map">
<NODE name="Content" factory="String"><![CDATA[
<p></p>
]]></NODE>
<NODE name="IncludeContent" factory="Boolean" value="true"/>
</NODE>
</content>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment