Commit 85a7be25 by chenith Committed by Harsh Shah

Added emailer to send new account created email.

parent 727fe17c
package performa.form; package performa.form;
import java.util.Date;
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.email.ConfigurableArticleTemplateEmailer;
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;
...@@ -11,12 +17,14 @@ import oneit.servlets.process.*; ...@@ -11,12 +17,14 @@ import oneit.servlets.process.*;
import oneit.servlets.security.SessionSecUserDecorator; import oneit.servlets.security.SessionSecUserDecorator;
import oneit.utils.*; import oneit.utils.*;
import performa.orm.*; import performa.orm.*;
import performa.utils.Utils;
import performa.utils.WebUtils;
public class VerifyIdentityFP extends ORMProcessFormProcessor public class VerifyIdentityFP extends ORMProcessFormProcessor
{ {
private static LoggingArea LOG = LoggingArea.createLoggingArea("VerifyIdentity"); private static LoggingArea LOG = LoggingArea.createLoggingArea("VerifyIdentity");
protected ConfigurableArticleTemplateEmailer emailer;
@Override @Override
protected Map validate(SubmissionDetails submission, MultiException exceptions) protected Map validate(SubmissionDetails submission, MultiException exceptions)
...@@ -41,6 +49,7 @@ public class VerifyIdentityFP extends ORMProcessFormProcessor ...@@ -41,6 +49,7 @@ public class VerifyIdentityFP extends ORMProcessFormProcessor
BusinessObjectParser.assertFieldCondition(job.getPassword()!= null, job, Job.FIELD_Password, "mandatory", exceptions, true, request); BusinessObjectParser.assertFieldCondition(job.getPassword()!= null, job, Job.FIELD_Password, "mandatory", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(job.getConfirmPassword()!= null, job, Job.FIELD_ConfirmPassword, "mandatory", exceptions, true, request); BusinessObjectParser.assertFieldCondition(job.getConfirmPassword()!= null, job, Job.FIELD_ConfirmPassword, "mandatory", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(CollectionUtils.equals(job.getPassword(), job.getConfirmPassword()), job, Job.FIELD_ConfirmPassword, "passwordNotMatch", exceptions, true, request); BusinessObjectParser.assertFieldCondition(CollectionUtils.equals(job.getPassword(), job.getConfirmPassword()), job, Job.FIELD_ConfirmPassword, "passwordNotMatch", exceptions, true, request);
} }
return super.validate(submission, exceptions); return super.validate(submission, exceptions);
...@@ -67,6 +76,8 @@ public class VerifyIdentityFP extends ORMProcessFormProcessor ...@@ -67,6 +76,8 @@ public class VerifyIdentityFP extends ORMProcessFormProcessor
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);
request.getSession().setAttribute (SecUser.SEC_USER_ID, secUser); request.getSession().setAttribute (SecUser.SEC_USER_ID, secUser);
request.getSession().setAttribute (SessionSecUserDecorator.REFRESH_SECURITY, Boolean.TRUE); request.getSession().setAttribute (SessionSecUserDecorator.REFRESH_SECURITY, Boolean.TRUE);
// request.setAttribute("nextPage", nextPage + "&JobID=" + job.getObjectID()); // request.setAttribute("nextPage", nextPage + "&JobID=" + job.getObjectID());
...@@ -79,4 +90,35 @@ public class VerifyIdentityFP extends ORMProcessFormProcessor ...@@ -79,4 +90,35 @@ public class VerifyIdentityFP extends ORMProcessFormProcessor
return new ProcessRedirectResult(nextPage + "&JobID=" + job.getObjectID(), new String[0]); return new ProcessRedirectResult(nextPage + "&JobID=" + job.getObjectID(), new String[0]);
} }
@Override
public void init(ParticipantInitialisationContext context) throws InitialisationException
{
super.init(context);
emailer = (ConfigurableArticleTemplateEmailer) (context.getSingleChild("AccountCreatedEmailer"));
}
protected void sendMail(Candidate candidate, HttpServletRequest request) throws BusinessException
{
try
{
LogMgr.log(LOG, LogLevel.PROCESSING1, "Sending Account Created mail from VerifyIdentityFP to :: ", candidate);
Map defaultParams = CollectionUtils.EMPTY_MAP;
ObjectTransform transform = Utils.createCompoundTransform(defaultParams, candidate);
Utils.sendMail(emailer, transform, new String[]{candidate.getUser().getUserName()}, null, candidate);
LogMgr.log(LOG, LogLevel.PROCESSING1, "Sent Account Created mail successfully from " + VerifyIdentityFP.class + " to :: ", candidate);
}
catch (ConfigurableEmailerException ex)
{
LogMgr.log(LOG, LogLevel.SYSTEMERROR1, ex, "Error occured while sending mail for Candidate :: " + candidate);
throw new BusinessException("We are unable to send mail. Please try again or contact Talentology for more details.");
}
}
} }
\ No newline at end of file
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
<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"/>
</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"/>
<FORM name="*.saveAndExitCulture" factory="Participant" class="performa.form.SaveAndExitCultureFP"/> <FORM name="*.saveAndExitCulture" factory="Participant" class="performa.form.SaveAndExitCultureFP"/>
......
<?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 Created Mail">
<createSpecificIdentifier factory='String' value='JMZDIPT76HCPJ5FDHSTH0G95R5BZX4'/>
<articleIdentifiers factory="Array" class="java.lang.String">
<NODE factory="String" value="JMZDIPT76HCPJ5FDHSTH0G95R5BZX4"/>
</articleIdentifiers>
<createdLabel factory="String" value="JMZDIPT76HCPJ5FDHSTH0G95R5BZX4"/>
<newParentCategory factory="String" value="created:N6SFUFOG4A2H5U7ER9T8YDQI56H2TG"/>
<articleAttributeChanges factory="Map">
<NODE name="EmailTo" factory="Null"/>
<NODE name="EmailFrom" factory="String" value="info@talentology.com.au"/>
<NODE name="EmailSubject" factory="String" value="Account Created"/>
<NODE name="Shortcuts" factory="String" value="AccountCreated Mail"/>
<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 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>Hello,</p>
<p>You have successfully registered and&nbsp;created&nbsp;an&nbsp;account&nbsp;with Talentology.</p>
<p>Thank You.</p>
</body>
</html>
]]></NODE>
<NODE name="TransformedContent" factory="String"><![CDATA[<p>Hello,</p><p>You have successfully registered and&nbsp;created&nbsp;an&nbsp;account&nbsp;with Talentology.</p><p>Thank You.</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
...@@ -63,28 +63,27 @@ ...@@ -63,28 +63,27 @@
$(document.body).addClass('bg-color'); $(document.body).addClass('bg-color');
$(document).ready(function() { $(document).ready(function() {
$('.reset-pw-btn').attr('disabled', 'disabled');
validate(); validate();
$('input').on('change keyup', function() { validate() });
$('.reset-pw').keyup(function() { interval = setInterval(function() { validate(); }, 500);
validate();
});
}); });
function validate() { function validate() {
var empty = false; var empty = false;
$('input[required]').each(function() {
$('input.reset-pw').each(function() {
if ($( this ).val() == '') { if ($( this ).val() == '') {
empty = true; empty = true;
if ($( this ).css('background-color') == 'rgb(250, 255, 189)') {
empty = false;
}
} }
}); });
if(empty) { if (empty) {
$('.reset-pw-btn').attr('disabled', 'disabled'); $('.verify-btn').attr('disabled', 'disabled');
} else { } else {
$('.reset-pw-btn').removeAttr('disabled'); $('.verify-btn').removeAttr('disabled');
clearInterval(interval);
} }
} }
</script> </script>
...@@ -111,16 +110,16 @@ ...@@ -111,16 +110,16 @@
<div class="row"> <div class="row">
<div class="form-group text-left col-sm-6 col-xs-12"> <div class="form-group text-left col-sm-6 col-xs-12">
<label><oneit:ormlabel obj="<%= secUser %>" field="FirstName" /></label> <label><oneit:ormlabel obj="<%= secUser %>" field="FirstName" /></label>
<oneit:ormInput obj="<%= secUser %>" type="text" attributeName="FirstName" cssClass="form-control second-style" /> <oneit:ormInput obj="<%= secUser %>" type="text" attributeName="FirstName" cssClass="form-control second-style" required/>
</div> </div>
<div class="form-group text-left col-sm-6 col-xs-12"> <div class="form-group text-left col-sm-6 col-xs-12">
<label><oneit:ormlabel obj="<%= secUser %>" field="LastName" /></label> <label><oneit:ormlabel obj="<%= secUser %>" field="LastName" /></label>
<oneit:ormInput obj="<%= secUser %>" type="text" attributeName="LastName" cssClass="form-control second-style" /> <oneit:ormInput obj="<%= secUser %>" type="text" attributeName="LastName" cssClass="form-control second-style" required/>
</div> </div>
</div> </div>
<div class="form-group text-left"> <div class="form-group text-left">
<label><oneit:ormlabel obj="<%= candidate %>" field="Phone" /></label> <label><oneit:ormlabel obj="<%= candidate %>" field="Phone" /></label>
<oneit:ormInput obj="<%= candidate %>" type="text" attributeName="Phone" cssClass="form-control second-style" /> <oneit:ormInput obj="<%= candidate %>" type="text" attributeName="Phone" cssClass="form-control second-style" required/>
</div> </div>
<% <%
if(isVerify) if(isVerify)
...@@ -128,18 +127,18 @@ ...@@ -128,18 +127,18 @@
%> %>
<div class="form-group text-left"> <div class="form-group text-left">
<label>Password</label> <label>Password</label>
<oneit:ormInput obj="<%= job %>" type="password" attributeName="Password" cssClass="form-control second-style reset-pw"/> <oneit:ormInput obj="<%= job %>" type="password" attributeName="Password" cssClass="form-control second-style reset-pw" required/>
</div> </div>
<div class="form-group text-left"> <div class="form-group text-left">
<label>Confirm password</label> <label>Confirm password</label>
<oneit:ormInput obj="<%= job %>" type="password" attributeName="ConfirmPassword" cssClass="form-control second-style reset-pw"/> <oneit:ormInput obj="<%= job %>" type="password" attributeName="ConfirmPassword" cssClass="form-control second-style reset-pw" required/>
</div> </div>
<% <%
} }
%> %>
<div class="text-center"> <div class="text-center">
<oneit:button value="<%= isVerify ? "Sign In" : "Verify and proceed"%>" name="verifyIdentity" cssClass="box-btn reset-pw-btn" <oneit:button value="<%= isVerify ? "Create my account" : "Verify and proceed"%>" name="verifyIdentity" cssClass="box-btn verify-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage) requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry("Job",job) .mapEntry("Job",job)
.mapEntry("Candidate",candidate) .mapEntry("Candidate",candidate)
......
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