Commit 46853397 by Nilu

S26465112 # Client - Incoming Issues (raised by Client) #Refinements to the process

1. There is an automatic email "Please verify your email address". We can do this email via the messaging system so that email can be removed (we will replace it via the messaging system)

Added verify link functionality to messaging engine
parent ee0d2a88
......@@ -21,9 +21,10 @@ import performa.orm.ScheduledEmail;
import performa.orm.SentEmail;
import performa.orm.types.PlaceholderOptions;
import oneit.net.LoopbackHTTP;
import oneit.utils.RandomStringGen;
import performa.orm.Candidate;
import performa.orm.Job;
import static performa.utils.Utils.APPLICANT_VERIFY_LINK;
import performa.utils.Utils;
public class MessagingEngineBatch extends ORMBatch implements InitialisationParticipant
......@@ -47,13 +48,26 @@ public class MessagingEngineBatch extends ORMBatch implements InitialisationPart
Job job = jobApplication.getJob();
Candidate candidate = jobApplication.getCandidate();
String jobLink = LoopbackHTTP.getRemoteAccessURL()
+ "/ApplicantPortal-ApplyJob.htm?cms.rm=SignIn&JobID="
+ jobApplication.getJob().getID()
String jobLink = LoopbackHTTP.getRemoteAccessURL()
+Utils.APPLICANT_SIGN_IN
+ "&JobID=" + jobApplication.getJob().getID()
+ "&UserName=" + candidate.getUser().getUserName();
//set invitation key and send mail time
if(scheduledEmail.getMessageContent().contains(PlaceholderOptions.VERIFY_LINK.getPlaceholder()))
{
if( candidate.getVerificationKey() == null)
{
RandomStringGen random = new RandomStringGen();
candidate.setVerificationKey(random.generateAlphaNum(6));
}
candidate.setVerificationMailSendDate(new Date());
}
String verifyLink = LoopbackHTTP.getRemoteAccessURL()
+ APPLICANT_VERIFY_LINK
+ Utils.APPLICANT_VERIFY_LINK
+ "?id=" + job.getID()
+ "&key=" + job.getRandomKey()
+ "&aid=" + candidate.getID()
......
......@@ -152,11 +152,6 @@ public class SendVerificationMailFP extends SaveFP
candidate.setIsAccountVerified(true);
}
}
else
{
Utils.sendVerificationMail(candidate, job, emailer, SendVerificationMailFP.class.getName());
}
}
return super.processForm(process, submission, params);
......
......@@ -7,7 +7,6 @@ import javax.mail.internet.*;
import javax.mail.search.*;
import oneit.appservices.config.ConfigMgr;
import oneit.components.*;
import oneit.email.ConfigurableArticleTemplateEmailer;
import oneit.email.EmailFetcher;
import oneit.logging.*;
import oneit.objstore.*;
......@@ -29,8 +28,6 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
private static final Integer SYNC_EMAILS_SINCE_MINUTES = ConfigMgr.getKeyfileInt("sync.emails.since.minutes", 30*60); //Applicable only when SYNC_ALL_EXISTING_EMAILS is false.
public static final LoggingArea LOG = LoggingArea.createLoggingArea("PerformaEmailFetcher");
private static ConfigurableArticleTemplateEmailer emailer;
@Override
public void run()
{
......@@ -378,23 +375,6 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
{
jobApplication.setCoverLetter(contents.get(1));
}
sendVerificationEmail(newUser, candidate, job);
}
private void sendVerificationEmail(boolean newUser, Candidate candidate, Job job)
{
try
{
if(newUser)
{
Utils.sendVerificationMail(candidate, job, emailer, PerformaEmailFetcher.class.getName());
}
}
catch (BusinessException e)
{
LogMgr.log(LOG, LogLevel.PROCESSING2 , e, "Batch Email Fetcher : Error while sending verification email ");
}
}
private void handleIndeedEmail(ObjectTransaction objTran, Job job) throws StorageException, FieldException
......@@ -440,7 +420,6 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
jobApplication.setCV(contents.get(0));
}
sendVerificationEmail(newUser, candidate, job);
}
private void createEmailMessage(ObjectTransaction objTran, Job job) throws StorageException, FieldException
......@@ -530,7 +509,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
@Override
public void init (ParticipantInitialisationContext context) throws InitialisationException
{
emailer = (ConfigurableArticleTemplateEmailer)(context.getSingleChild("AccountVerificationEmailer"));
}
public static final void main (String[] args) throws Exception
......
......@@ -45,6 +45,7 @@ public class Utils
public static final String PRIV_ACCESS_COMPANY = "TL_AccessCompany";
public static final String ADVT_CONFIG_EMAIL_EXTENSION = ConfigMgr.getKeyfileString ("advt.config.email.extension", "matchdmail.com");
public static final String APPLICANT_VERIFY_LINK = "/ApplicantPortal-Applicant_Account_Verification.htm";
public static final String APPLICANT_SIGN_IN = "/ApplicantPortal-ApplyJob.htm?cms.rm=SignIn";
public static Role getRole(String role, ObjectTransaction transaction)
{
......@@ -428,48 +429,6 @@ public class Utils
}
public static void sendVerificationMail(Candidate candidate, Job job, ConfigurableArticleTemplateEmailer emailer, String callingClass) throws BusinessException
{
if(!candidate.isTrue(candidate.getIsAccountVerified()))
{
try
{
LogMgr.log(Candidate.LOG, LogLevel.PROCESSING1, "Sending verification mail from SendVerificationMailFP to :: ", candidate);
RandomStringGen random = new RandomStringGen();
//set verification key and send mail time
candidate.setVerificationKey(random.generateAlphaNum(6));
candidate.setVerificationMailSendDate(new Date());
String link = LoopbackHTTP.getRemoteAccessURL()
+ APPLICANT_VERIFY_LINK
+ "?id=" + job.getID()
+ "&key=" + job.getRandomKey()
+ "&aid=" + candidate.getID()
+ "&pin=" + candidate.getVerificationKey();
Map defaultParams = CollectionUtils.mapEntry("link", link).toMap();
ObjectTransform transform = Utils.createCompoundTransform(defaultParams, candidate.getUser(), job);
Utils.sendMail(emailer, transform, new String[]{candidate.getUser().getUserName()}, null, candidate);
LogMgr.log(Candidate.LOG, LogLevel.PROCESSING1, "Sent verification mail successfully from " + callingClass + " to :: ", candidate);
}
catch (ConfigurableEmailerException ex)
{
LogMgr.log(Candidate.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 Matchd for more details.");
}
}
else
{
LogMgr.log(Candidate.LOG, LogLevel.PROCESSING1, "Call from " + callingClass + ". Account is already verified for candidate :: ", candidate);
}
}
public static void sendVerificationMail(Job job, CompanyUser companyUser, HttpServletRequest request, ConfigurableArticleTemplateEmailer emailer, String callingClass) throws BusinessException
{
if(!CollectionUtils.equals(companyUser.getIsAccountVerified(), Boolean.TRUE))
......
......@@ -91,6 +91,11 @@
.pl-verify {margin: 8.3% auto 9px !important}
body {background-color: #e9ecef !important}
.email input[name$="Email"] {
opacity: 0;
position: absolute;
}
</style>
<div class="apply-job-logo-header signinpage">
......@@ -121,6 +126,10 @@
<div id="overlay">
<div class="modal-dialog">
<div class="modal-body main-password-popup">
<div class="form-group text-left email">
<label style="display: none;"><oneit:ormlabel obj="<%= secUser %>" field="Email" /></label>
<oneit:ormInput obj="<%= secUser %>" type="text" attributeName="Email" cssClass="form-control"/>
</div>
<div class="form-group text-left pwd-box">
<label class="pwd-label">Password</label>
<oneit:ormInput obj="<%= job %>" type="password" attributeName="Password" cssClass="form-control second-style pwd-input-box" autofocus="true"/>
......
......@@ -35,7 +35,6 @@
<NODE name="WEB_BATCH::Email">
<TASK factory="Participant" class="oneit.appservices.batch.DefaultTask">
<RUN class="performa.utils.PerformaEmailFetcher" factory="Participant">
<AccountVerificationEmailer factory="Participant" class="oneit.email.ConfigurableArticleTemplateEmailer" templateShortcut="AccountVerificationMail"/>
</RUN>
<WHEN factory="MetaComponent" component="BatchSchedule" selector="performa.runbatch">
<NODE name="schedule" class="oneit.appservices.batch.QuickSchedule">
......
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