Commit bc5e77e8 by chenith Committed by Harsh Shah

Introduced a Email-based new sign in method for applicant portal. New candidate…

Introduced a Email-based new sign in method for applicant portal. New candidate registration, updated existing candidate login.
parent 7fd2f4b7
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
<column name="object_created_date" type="Date" nullable="false" length="22"/> <column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="object_type" type="String" nullable="false" length="30"/> <column name="object_type" type="String" nullable="false" length="30"/>
<column name="phone" type="String" nullable="true" length="30"/> <column name="phone" type="String" nullable="true" length="30"/>
<column name="verification_mail_send_date" type="Date" nullable="true"/>
<column name="verification_key" type="String" nullable="true" length="10"/>
<column name="is_account_verified" type="Boolean" nullable="true"/>
<column name="test_input_id" type="Long" length="11" nullable="true"/> <column name="test_input_id" type="Long" length="11" nullable="true"/>
<column name="user_id" type="Long" length="11" nullable="true"/> <column name="user_id" type="Long" length="11" nullable="true"/>
</NODE> </NODE>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation"> <NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_level_type</tableName> <tableName factory="String">tl_level_type</tableName>
<column name="object_id" type="Long" nullable="true" length="11"/> <column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/> <column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/> <column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="type_flag" type="String" nullable="true" length="200"/> <column name="type_flag" type="String" nullable="true" length="200"/>
......
...@@ -9,6 +9,9 @@ CREATE TABLE oneit_sec_user_extension ( ...@@ -9,6 +9,9 @@ CREATE TABLE oneit_sec_user_extension (
object_created_date datetime DEFAULT getdate() NOT NULL object_created_date datetime DEFAULT getdate() NOT NULL
, object_type varchar(30) NOT NULL , , object_type varchar(30) NOT NULL ,
phone varchar(30) NULL, phone varchar(30) NULL,
verification_mail_send_date datetime NULL,
verification_key varchar(10) NULL,
is_account_verified char(1) NULL,
test_input_id numeric(12) NULL, test_input_id numeric(12) NULL,
user_id numeric(12) NULL user_id numeric(12) NULL
); );
......
...@@ -10,6 +10,9 @@ CREATE TABLE oneit_sec_user_extension ( ...@@ -10,6 +10,9 @@ CREATE TABLE oneit_sec_user_extension (
object_created_date date DEFAULT SYSDATE NOT NULL object_created_date date DEFAULT SYSDATE NOT NULL
, object_type varchar2(30) NOT NULL , , object_type varchar2(30) NOT NULL ,
phone varchar2(30) NULL, phone varchar2(30) NULL,
verification_mail_send_date date NULL,
verification_key varchar2(10) NULL,
is_account_verified char(1) NULL,
test_input_id number(12) NULL, test_input_id number(12) NULL,
user_id number(12) NULL user_id number(12) NULL
); );
......
...@@ -10,6 +10,9 @@ CREATE TABLE oneit_sec_user_extension ( ...@@ -10,6 +10,9 @@ CREATE TABLE oneit_sec_user_extension (
object_created_date timestamp DEFAULT NOW() NOT NULL object_created_date timestamp DEFAULT NOW() NOT NULL
, object_type varchar(30) NOT NULL , , object_type varchar(30) NOT NULL ,
phone varchar(30) NULL, phone varchar(30) NULL,
verification_mail_send_date timestamp NULL,
verification_key varchar(10) NULL,
is_account_verified char(1) NULL,
test_input_id numeric(12) NULL, test_input_id numeric(12) NULL,
user_id numeric(12) NULL user_id numeric(12) NULL
); );
......
package performa.form;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.objstore.StorageException;
import oneit.objstore.parser.BusinessObjectParser;
import oneit.security.*;
import oneit.servlets.forms.*;
import oneit.servlets.process.*;
import oneit.servlets.security.SessionSecUserDecorator;
import oneit.utils.*;
import performa.orm.Candidate;
import performa.orm.Job;
import performa.orm.JobApplication;
public class ResetPasswordFP extends ORMProcessFormProcessor
{
@Override
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
{
HttpServletRequest request = submission.getRequest();
Job job = (Job) request.getAttribute("Job");
Candidate candidate = (Candidate) request.getAttribute("NewCandidate");
String nextPage = (String) request.getAttribute("nextPage");
LogMgr.log(JobApplication.LOG, LogLevel.PROCESSING1, "Inside ResetPasswordFP for ", job, candidate);
SecUser secUser = candidate.getUser();
if(CollectionUtils.equals(job.getPassword(), job.getConfirmPassword()))
{
secUser.setAttribute("md5:" + SecUser.FIELD_Password, job.getPassword());
candidate.setIsAccountVerified(Boolean.TRUE);
}
request.getSession().setAttribute (SecUser.SEC_USER_ID, secUser);
request.getSession().setAttribute (SessionSecUserDecorator.REFRESH_SECURITY, Boolean.TRUE);
process.completeAndRestart();
process.setAttributeIgnoreTX("Job", job);
return new ProcessRedirectResult(nextPage, new String[0]);
}
@Override
public void validate(ORMProcessState process, SubmissionDetails submission, MultiException exceptions, Map params) throws StorageException
{
HttpServletRequest request = submission.getRequest();
Job job = (Job) request.getAttribute("Job");
Candidate candidate = (Candidate) request.getAttribute("NewCandidate");
if(candidate!=null)
{
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(CollectionUtils.equals(job.getPassword(), job.getConfirmPassword()), job, Job.FIELD_ConfirmPassword, "passwordNotMatch", exceptions, true, request);
}
super.validate(process, submission, exceptions, params);
}
}
package performa.form;
import java.util.Date;
import java.util.Map;
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.net.LoopbackHTTP;
import oneit.objstore.ObjectTransaction;
import oneit.objstore.StorageException;
import oneit.objstore.parser.BusinessObjectParser;
import oneit.security.SecUser;
import oneit.servlets.forms.*;
import oneit.servlets.process.*;
import oneit.utils.*;
import performa.orm.*;
import performa.utils.Utils;
import performa.utils.WebUtils;
public class SendVerificationMailFP extends SaveFP
{
private static LoggingArea LOG = LoggingArea.createLoggingArea("SendVerificationLink");
private static final String DEFAULT_PASSWORD = "Talentology123";
protected ConfigurableArticleTemplateEmailer emailer;
@Override
public void validate(ORMProcessState process, SubmissionDetails submission, MultiException exceptions, Map params) throws StorageException
{
HttpServletRequest request = submission.getRequest();
Job job = (Job) request.getAttribute("Job");
BusinessObjectParser.assertFieldCondition(!job.isEmailFound(), job, Job.FIELD_Email, "emailExists", exceptions, true, request);
super.validate(process, submission, exceptions, params);
}
@Override
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
{
HttpServletRequest request = submission.getRequest();
ObjectTransaction objTran = process.getTransaction();
Job job = (Job) request.getAttribute("Job");
String email = job.getEmail();
Debug.assertion(email != null, "Email not avaialble");
LogMgr.log(LOG, LogLevel.PROCESSING1, "Started to send varification email.", job , email);
SecUser secUser = SecUser.searchNAME(objTran, email);
Debug.assertion(secUser == null, "user available", email);
LogMgr.log(LOG, LogLevel.PROCESSING1, "Inside SendVerificationMailFP for send account verification mail for ", email);
SecUser newSecUser = SecUser.createSecUser(objTran);
newSecUser.setUserName(email);
newSecUser.setAttribute("md5:" + SecUser.FIELD_Password, DEFAULT_PASSWORD);
LogMgr.log(LOG, LogLevel.PROCESSING1, "New user created :: ", newSecUser);
newSecUser.addRole(Utils.getRole(Utils.ROLE_APPLICANT, objTran));
Candidate candidate = newSecUser.getExtensionOrCreate(Candidate.REFERENCE_Candidate);
sendVerificationMail(candidate, job, request);
request.setAttribute("nextPage", request.getAttribute("nextPage") + "&VerificationLinkSent=true&JobID=" + job.getID());
return super.processForm(process, submission, params);
}
@Override
public void init(ParticipantInitialisationContext context) throws InitialisationException
{
super.init(context);
emailer = (ConfigurableArticleTemplateEmailer) (context.getSingleChild("AccountVerificationEmailer"));
}
protected void sendVerificationMail(Candidate candidate, Job job, HttpServletRequest request) throws BusinessException
{
if(candidate.getIsAccountVerified()!=Boolean.TRUE)
{
try
{
LogMgr.log(LOG, LogLevel.PROCESSING1, "Sending verification mail from SendVerificationMailFP to :: ", candidate);
Article verificationArticle = WebUtils.getArticleByShortCut(candidate.getTransaction(), WebUtils.APPLY_JOB);
RandomStringGen random = new RandomStringGen();
//set verification key and send mail time
candidate.setVerificationKey(random.generateAlphaNum(6));
candidate.setVerificationMailSendDate(new Date());
String link = LoopbackHTTP.getRemoteAccessURL(request)
+ verificationArticle.getLink(request, CollectionUtils.EMPTY_MAP, "/")
+ "?cms%2Erm=SignIn"
+ "&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);
Utils.sendMail(emailer, transform, new String[]{candidate.getUser().getUserName()}, null, candidate);
LogMgr.log(LOG, LogLevel.PROCESSING1, "Sent verification mail successfully from " + SendVerificationMailFP.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 Talantology for more details.");
}
}
else
{
LogMgr.log(LOG, LogLevel.PROCESSING1, "Call from " + SendVerificationMailFP.class + ". Account is already verified for candidate :: ", candidate);
}
}
}
\ No newline at end of file
...@@ -5,10 +5,8 @@ import javax.servlet.http.HttpServletRequest; ...@@ -5,10 +5,8 @@ import javax.servlet.http.HttpServletRequest;
import oneit.logging.*; import oneit.logging.*;
import oneit.objstore.*; import oneit.objstore.*;
import oneit.objstore.parser.BusinessObjectParser; import oneit.objstore.parser.BusinessObjectParser;
import oneit.objstore.services.TransactionTask;
import oneit.security.*; import oneit.security.*;
import oneit.servlets.forms.*; import oneit.servlets.forms.*;
import oneit.servlets.process.*;
import oneit.utils.*; import oneit.utils.*;
import oneit.utils.parsers.FieldException; import oneit.utils.parsers.FieldException;
import performa.orm.*; import performa.orm.*;
...@@ -17,60 +15,39 @@ import performa.utils.Utils; ...@@ -17,60 +15,39 @@ import performa.utils.Utils;
public class SignInCandidateFP extends LoginProcessor public class SignInCandidateFP extends LoginProcessor
{ {
private static final String DEFAULT_PASSWORD = "Talentology123";
@Override @Override
public SuccessfulResult processForm(SubmissionDetails submission, Map params) throws BusinessException, StorageException public SuccessfulResult processForm(SubmissionDetails submission, Map params) throws BusinessException, StorageException
{ {
HttpServletRequest request = submission.getRequest(); HttpServletRequest request = submission.getRequest();
ORMProcessState process = (ORMProcessState)ProcessDecorator.getDefaultProcess(request);
ObjectTransaction objTran = process.getTransaction();
Job job = (Job) request.getAttribute("Job"); Job job = (Job) request.getAttribute("Job");
String nextPage = (String) request.getAttribute("nextPage"); String nextPage = (String) request.getAttribute("nextPage");
String email = job.getEmail(); String email = job.getEmail();
final Map userMap = new HashMap();
LogMgr.log(JobApplication.LOG, LogLevel.PROCESSING1, "Inside SignInCandidateFP for ", job, " Email:", email); LogMgr.log(JobApplication.LOG, LogLevel.PROCESSING1, "Inside SignInCandidateFP for ", job, " Email:", email);
SecUser secUser = SecUser.searchNAME(objTran, email); userMap.put("username", job.getEmail());
final Map userMap = new HashMap(); userMap.put("password", job.getPassword());
if(secUser == null) request.setAttribute("nextPage", nextPage + "&JobID=" + job.getObjectID());
{
objTran.runInNewTX(new TransactionTask()
{
@Override
public void run(ObjectTransaction newObjTran) throws FieldException, StorageException
{
SecUser newSecUser = SecUser.createSecUser(newObjTran);
newSecUser.setUserName(email); return super.processForm(submission, userMap);
newSecUser.setAttribute("md5:" + SecUser.FIELD_Password, DEFAULT_PASSWORD); }
LogMgr.log(JobApplication.LOG, LogLevel.PROCESSING1, "New user created :: ", newSecUser);
newSecUser.addRole(Utils.getRole(Utils.ROLE_APPLICANT, newObjTran)); @Override
newSecUser.getExtensionOrCreate(Candidate.REFERENCE_Candidate); protected void checkUserCanLogin(ObjectTransaction trans, SecUser userToCheck, SubmissionDetails submission, Map requestParams) throws FieldException, MultiException
{
super.checkUserCanLogin(trans, userToCheck, submission, requestParams);
userMap.put("username", newSecUser.getUserName()); Candidate candidate = userToCheck.getExtension(Candidate.REFERENCE_Candidate);
userMap.put("password", DEFAULT_PASSWORD);
} if(!Utils.checkApplicantPortalAccess(userToCheck) || candidate == null || candidate.getIsAccountVerified()!=Boolean.TRUE)
});
}
else if(!secUser.hasPrivilege(Utils.PRIV_ACCESS_APPLICANT_PORTAL) || secUser.getExtension(Candidate.REFERENCE_Candidate) == null)
{ {
throw new BusinessException("You are not allowed to access this portal"); throw new FieldException("You're not an authorised user to access this portal.", SecUser.FIELD_UserName);
} }
else
{
LogMgr.log(JobApplication.LOG, LogLevel.PROCESSING1, "Existing user skipping password check :: ", secUser);
userMap.put("username", secUser.getUserName());
userMap.put("password", DEFAULT_PASSWORD);
} }
request.setAttribute("nextPage", nextPage + "&JobID=" + job.getObjectID());
return super.processForm(submission, userMap);
}
@Override @Override
protected Map validate(SubmissionDetails submission, MultiException exceptions) protected Map validate(SubmissionDetails submission, MultiException exceptions)
...@@ -79,10 +56,12 @@ public class SignInCandidateFP extends LoginProcessor ...@@ -79,10 +56,12 @@ public class SignInCandidateFP extends LoginProcessor
Job job = (Job) request.getAttribute("Job"); Job job = (Job) request.getAttribute("Job");
BusinessObjectParser.assertFieldCondition(job.getEmail()!= null, job, Job.FIELD_Email, "mandatory", exceptions, true, request); BusinessObjectParser.assertFieldCondition(job.getEmail()!= null, job, Job.FIELD_Email, "mandatory", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(job.getPassword()!= null, job, Job.FIELD_Password, "mandatory", exceptions, true, request);
return super.validate(submission, exceptions); return super.validate(submission, exceptions);
} }
@Override @Override
public SuccessfulResult processSuccessfulLogin(SubmissionDetails submission, Map requestParameters, SecUser secUser) throws BusinessException public SuccessfulResult processSuccessfulLogin(SubmissionDetails submission, Map requestParameters, SecUser secUser) throws BusinessException
{ {
......
package performa.orm; package performa.orm;
import java.util.Calendar;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import oneit.objstore.MessageSource;
import oneit.objstore.ObjectTransaction;
import oneit.servlets.objstore.MessageSourceDecorator;
import oneit.servlets.process.ORMProcessState;
import oneit.utils.CollectionUtils;
import oneit.utils.DateDiff;
import oneit.utils.StringUtils;
public class Candidate extends BaseCandidate public class Candidate extends BaseCandidate
{ {
...@@ -23,4 +34,45 @@ public class Candidate extends BaseCandidate ...@@ -23,4 +34,45 @@ public class Candidate extends BaseCandidate
{ {
return getUser() != null ? getUser().getName() : null; return getUser() != null ? getUser().getName() : null;
} }
public static String checkCandidate(HttpServletRequest request, ORMProcessState process)
{
ObjectTransaction transaction = process.getTransaction();
String candidateID = (String) request.getParameter("id");
String verificationCode = (String) request.getParameter("pin");
MessageSource messageSource = MessageSourceDecorator.getMessageSource(request);
Candidate candidate = null;
String errorMsg = "";
if(StringUtils.subBlanks(candidateID) != null && StringUtils.subBlanks(verificationCode) != null)
{
candidate = Candidate.getCandidateByID(transaction, Long.parseLong(candidateID));
process.setAttribute("Candidate", candidate);
}
else if(process.getAttribute("Candidate") != null)
{
candidate = (Candidate) process.getAttribute("Candidate");
}
else
{
errorMsg = messageSource.getFieldErrorMsg(Candidate.REFERENCE_Candidate, "", "UnauthorizedUser", null);
}
if(candidate == null)
{
errorMsg = messageSource.getFieldErrorMsg(Candidate.REFERENCE_Candidate, "", "UnauthorizedUser", null);
}
else if(!CollectionUtils.equals(verificationCode, candidate.getVerificationKey()))
{
errorMsg = messageSource.getFieldErrorMsg(Candidate.REFERENCE_Candidate, "", "WrongVerificationCode", null);
}
else if(DateDiff.getDateDiff(Calendar.HOUR, candidate.getVerificationMailSendDate(), new Date()) > 24)
{
errorMsg = messageSource.getFieldErrorMsg(Candidate.REFERENCE_Candidate, "", "LinkExpired", null);
}
return errorMsg;
}
} }
\ No newline at end of file
...@@ -14,10 +14,22 @@ ...@@ -14,10 +14,22 @@
<ATTRIB name="Phone" type="String" dbcol="phone" length="30"/> <ATTRIB name="Phone" type="String" dbcol="phone" length="30"/>
<ATTRIB name="VerificationMailSendDate" type="Date" dbcol="verification_mail_send_date" />
<ATTRIB name="VerificationKey" type="String" dbcol="verification_key" length="10"/>
<ATTRIB name="IsAccountVerified" type="Boolean" dbcol="is_account_verified" defaultValue="Boolean.FALSE"/>
<SINGLEREFERENCE name="TestInput" type="TestInput" dbcol="test_input_id" backreferenceName="Candidates" /> <SINGLEREFERENCE name="TestInput" type="TestInput" dbcol="test_input_id" backreferenceName="Candidates" />
<SINGLEREFERENCE name="User" type="SecUser" dbcol="user_id" backreferenceName="Extensions" inSuper='TRUE'/> <SINGLEREFERENCE name="User" type="SecUser" dbcol="user_id" backreferenceName="Extensions" inSuper='TRUE'/>
</TABLE> </TABLE>
<SEARCH type="All" paramFilter="oneit_sec_user_extension.object_id is not null" >
</SEARCH>
<SEARCH type="IdPin" paramFilter="oneit_sec_user_extension.object_id is not null" singleton="TRUE">
<PARAM name="ID" type="Long" paramFilter="object_id = ${ID} " />
<PARAM name="Pin" type="String" paramFilter="verification_key = ${Pin}" />
</SEARCH>
</BUSINESSCLASS> </BUSINESSCLASS>
</ROOT> </ROOT>
\ No newline at end of file
...@@ -398,4 +398,20 @@ public class Job extends BaseJob ...@@ -398,4 +398,20 @@ public class Job extends BaseJob
return location.toString(); return location.toString();
} }
public Boolean isEmailFound()
{
if(getEmail()!=null)
{
SecUser user = SecUser.searchNAME(getTransaction(), getEmail());
if(user!=null && user.getExtension(Candidate.REFERENCE_Candidate)!=null)
{
return Boolean.TRUE;
}
}
return Boolean.FALSE;
}
} }
\ No newline at end of file
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
<MULTIPLEREFERENCE name="CultureCriterias" type="CultureCriteria" backreferenceName="Job" /> <MULTIPLEREFERENCE name="CultureCriterias" type="CultureCriteria" backreferenceName="Job" />
<TRANSIENT name="Email" type="String" validators="Email" /> <TRANSIENT name="Email" type="String" validators="Email" />
<TRANSIENT name="Password" type="String"/>
<TRANSIENT name="ConfirmPassword" type="String"/>
<TRANSIENT name="CompletedDetails" type="Boolean" defaultValue="Boolean.FALSE"/> <TRANSIENT name="CompletedDetails" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="CompletedRequirements" type="Boolean" defaultValue="Boolean.FALSE"/> <TRANSIENT name="CompletedRequirements" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="CompletedCulture" type="Boolean" defaultValue="Boolean.FALSE"/> <TRANSIENT name="CompletedCulture" type="Boolean" defaultValue="Boolean.FALSE"/>
......
package performa.utils; package performa.utils;
import java.util.*; import java.util.*;
import javax.activation.DataSource;
import oneit.email.ConfigurableArticleTemplateEmailer;
import oneit.email.ConfigurableEmailerException;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.logging.LoggingArea;
import oneit.objstore.BaseBusinessClass;
import oneit.objstore.ObjectTransaction; import oneit.objstore.ObjectTransaction;
import oneit.objstore.rdbms.filters.GreaterThanEqualFilter; import oneit.objstore.rdbms.filters.GreaterThanEqualFilter;
import oneit.objstore.rdbms.filters.LessThanFilter; import oneit.objstore.rdbms.filters.LessThanFilter;
...@@ -13,6 +20,10 @@ import oneit.objstore.utils.*; ...@@ -13,6 +20,10 @@ import oneit.objstore.utils.*;
import oneit.utils.*; import oneit.utils.*;
import oneit.utils.filter.CollectionFilter; import oneit.utils.filter.CollectionFilter;
import oneit.utils.filter.Filter; import oneit.utils.filter.Filter;
import oneit.utils.transform.MapTransform;
import oneit.utils.transform.param.ErrorTransform;
import oneit.utils.transform.param.ORMTransform;
import oneit.utils.transform.param.PrefixCompoundTransform;
import performa.orm.types.AppSortOption; import performa.orm.types.AppSortOption;
/** /**
...@@ -168,4 +179,47 @@ public class Utils ...@@ -168,4 +179,47 @@ public class Utils
new ObjectTransform[]{transform}, new ObjectTransform[]{transform},
new Comparator[]{comparator}); new Comparator[]{comparator});
} }
public static ObjectTransform createCompoundTransform(Map defaultTransMap, BaseBusinessClass... bbcs)
{
PrefixCompoundTransform prefixTransform = new PrefixCompoundTransform();
if(defaultTransMap != null)
{
prefixTransform.setDefault(new MapTransform(defaultTransMap));
}
for(BaseBusinessClass bbc : bbcs)
{
if(bbc != null)
{
prefixTransform.add(bbc.getClass().getSimpleName(), new ORMTransform(bbc));
}
}
return new StringUtils.NullToBlankPostTransform(new ErrorTransform(prefixTransform, ""));
}
public static void sendMail(ConfigurableArticleTemplateEmailer emailer, ObjectTransform finalTransform, String[] emails, DataSource[] attachments, BaseBusinessClass bo) throws ConfigurableEmailerException
{
LogMgr.log(LoggingArea.ALL, LogLevel.PROCESSING1, "Sending Mail from Utils class to" + Arrays.toString(emails));
emailer.sendTransactionalEmail(bo.getTransaction(),
new Date(),
finalTransform,
emails,
null,
null,
null,
null,
null,
null,
attachments,
bo.getClass().getName(),
bo.getObjectID());
LogMgr.log(LoggingArea.ALL, LogLevel.PROCESSING1, "Mail sent from Utils class to " + Arrays.toString(emails));
}
} }
#atleastOneRequirement = Please add at least one Requirement. #atleastOneRequirement = Please add at least one Requirement.
#exceedMaxShortlisted = Selected number of applications exceed maximum shortlist application count #exceedMaxShortlisted = Selected number of applications exceed maximum shortlist application count
#saveTemplateFirst = Please save template first, before proceeding to the next step #saveTemplateFirst = Please save template first, before proceeding to the next step
#passwordNotMatch = The password does not match. Please try again.
\ No newline at end of file
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
<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"/>
<FORM name="*.saveAndExitWorkStyle" factory="Participant" class="performa.form.SaveAndExitWorkStypeFP"/> <FORM name="*.saveAndExitWorkStyle" factory="Participant" class="performa.form.SaveAndExitWorkStypeFP"/>
<FORM name="*.sendVerificationMail" factory="Participant" class="performa.form.SendVerificationMailFP">
<AccountVerificationEmailer factory="Participant" class="oneit.email.ConfigurableArticleTemplateEmailer" templateShortcut="AccountVerificationMail"/>
</FORM>
<FORM name="*.resetPassword" factory="Participant" class="performa.form.ResetPasswordFP"/>
</NODE> </NODE>
......
Job.Email = Email Address Job.Email = Email Address
Job.ConfirmPassword = Confirm Password
SecUser.FirstName = First Name SecUser.FirstName = First Name
SecUser.LastName = Last Name SecUser.LastName = Last Name
......
#completeCulture = Please complete the culture assessment. #completeCulture = Please complete the culture assessment.
#emailExists = An account already exists with this email address.
\ No newline at end of file
...@@ -6,14 +6,88 @@ ...@@ -6,14 +6,88 @@
<oneit:dynIncluded> <oneit:dynIncluded>
<% <%
ObjectTransaction objTran = process.getTransaction (); ObjectTransaction objTran = process.getTransaction ();
String currentPage = WebUtils.getSamePageInRenderMode(request, "SignIn");
String nextPage = WebUtils.getArticleLink(request, objTran, WebUtils.JOB_APPLICATION, "Page"); String nextPage = WebUtils.getArticleLink(request, objTran, WebUtils.JOB_APPLICATION, "Page");
String linkSent = (String) request.getParameter("VerificationLinkSent");
Job job = (Job) process.getAttribute("Job"); Job job = (Job) process.getAttribute("Job");
Candidate candidate = (Candidate) process.getAttribute("NewCandidate");
if(request.getParameter("JobID")!=null)
{
job = Job.getJobByID(transaction, Long.parseLong((String) request.getParameter("JobID")));
process.setAttribute("Job", job);
}
//to process candidate verification
String id = request.getParameter("id");
String key = request.getParameter("key");
String candidateId = request.getParameter("aid");
String pin = request.getParameter("pin");
if(id != null && key != null)
{
job = Job.searchJobKey(transaction, Long.parseLong(id), key);
}
if(candidateId!=null && pin!=null)
{
candidate = Candidate.searchIdPin(transaction, Long.parseLong(candidateId), pin);
if(candidate!=null && candidate.getIsAccountVerified()==Boolean.TRUE)
{
response.setStatus(404);
return;
}
}
process.setAttribute("Job", job);
process.setAttribute("NewCandidate", candidate);
Debug.assertion(job != null, "Job is null in applicant portal"); Debug.assertion(job != null, "Job is null in applicant portal");
%> %>
<script> <script type="text/javascript">
$(document.body).addClass('bg-color'); $(document.body).addClass('bg-color');
$(document).ready(function() {
recalcFunction = setupRecalc ($("form"), {'recalcOnError':true});
$('.send-link-btn').attr('disabled', 'disabled');
$('input[type="password"]').keyup(function() {
if($(this).val() != '') {
$('.sign-in-btn').removeAttr('disabled');
} else {
$('.sign-in-btn').attr('disabled', 'disabled');
}
});
// $('.reset-pw-btn').attr('disabled', 'disabled');
// $('.reset-pw').keyup(function() {
// if($(this).val() != '') {
// $('.reset-pw-btn').removeAttr('disabled');
// } else {
// $('.reset-pw-btn').attr('disabled', 'disabled');
// }
// });
});
</script> </script>
<style>
button[disabled] {
opacity: 0.6;
background-color: #0582ba;
}
</style>
<%
if(linkSent!=null)
{
request.setAttribute("VerificationLinkSent", null);
%>
<div class="alert alert-success verificationlinksent-info">
A verification email has been sent to you. Please check your email :)
</div>
<%
}
%>
<oneit:form name="applyJob" method="post" enctype="multipart/form-data"> <oneit:form name="applyJob" method="post" enctype="multipart/form-data">
...@@ -26,6 +100,11 @@ ...@@ -26,6 +100,11 @@
<oneit:toString value="<%= job.getPageTitle() %>" mode="EscapeHTML"/> <oneit:toString value="<%= job.getPageTitle() %>" mode="EscapeHTML"/>
</div> </div>
<div class="main-box-layout verify-i-setpone"> <div class="main-box-layout verify-i-setpone">
<%
if(candidate==null)
{
%>
<div class="box-label">Sign in using your social network of choice</div> <div class="box-label">Sign in using your social network of choice</div>
<ul class="social-login"> <ul class="social-login">
<li><a href="#"><img src="images/login-linkedin-icon.svg"></a></li> <li><a href="#"><img src="images/login-linkedin-icon.svg"></a></li>
...@@ -38,13 +117,64 @@ ...@@ -38,13 +117,64 @@
<label>Email Address</label> <label>Email Address</label>
<oneit:ormInput obj="<%= job %>" type="text" attributeName="Email" cssClass="form-control second-style" /> <oneit:ormInput obj="<%= job %>" type="text" attributeName="Email" cssClass="form-control second-style" />
</div> </div>
<oneit:recalcClass htmlTag="div" classScript="job.isEmailFound() ? 'show': 'hide'" job="<%= job %>">
<div class="form-group text-left">
<label>Password</label>
<oneit:ormInput obj="<%= job %>" type="password" attributeName="Password" cssClass="form-control second-style" />
</div>
<div class="form-group">
<oneit:button value="Sign In" name="signIn" cssClass="box-btn sign-in-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry("Job",job)
.mapEntry("procParams", CollectionUtils.mapEntry("Job", job).toMap())
.toMap() %>"/>
</div>
</oneit:recalcClass>
<oneit:recalcClass htmlTag="div" classScript="job.getEmail()==null || job.isEmailFound() ? 'hide': 'show'" job="<%= job %>">
<div class="form-group">
<oneit:button value="Send link" name="sendVerificationMail" cssClass="box-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", currentPage)
.mapEntry("Job",job)
.mapEntry("procParams", CollectionUtils.mapEntry("Job", job).toMap())
.mapEntry("restartProcess", Boolean.TRUE)
.mapEntry("attribNamesToRestore", "Job")
.mapEntry("attribNamesToRestore", Collections.singleton("Job"))
.toMap() %>"/>
</div>
</oneit:recalcClass>
<%
}
else
{
SecUser secUser = candidate.getUser();
job.setEmail(secUser.getUserName());
%>
<div class="form-group text-left">
<label>Email Address</label>
<oneit:ormInput obj="<%= job %>" type="text" attributeName="Email" cssClass="form-control second-style" disabled="true" readonly="true"/>
</div>
<div class="form-group text-left">
<label>Password</label>
<oneit:ormInput obj="<%= job %>" type="password" attributeName="Password" cssClass="form-control second-style reset-pw"/>
</div>
<div class="form-group text-left">
<label>Confirm password</label>
<oneit:ormInput obj="<%= job %>" type="password" attributeName="ConfirmPassword" cssClass="form-control second-style reset-pw"/>
</div>
<div class="form-group"> <div class="form-group">
<oneit:button value="Verify and proceed" name="signIn" cssClass="box-btn" <oneit:button value="Sign In" name="resetPassword" cssClass="box-btn reset-pw-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage) requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry("Job",job) .mapEntry("Job",job)
.mapEntry("NewCandidate",candidate)
.mapEntry("procParams", CollectionUtils.mapEntry("Job", job).toMap()) .mapEntry("procParams", CollectionUtils.mapEntry("Job", job).toMap())
.toMap() %>"/> .toMap() %>"/>
</div> </div>
<%
}
%>
</div> </div>
</div> </div>
</oneit:form> </oneit:form>
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au">
<NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.RedefineTableOperation">
<tableName factory="String">oneit_sec_user_extension</tableName>
<column name="verification_mail_send_date" type="Date" nullable="true"/>
<column name="verification_key" type="String" nullable="true" length="10"/>
<column name="is_account_verified" type="Boolean" nullable="true"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
<?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="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="info@talentology.com.au"/>
<NODE name="EmailSubject" factory="String" value="Verify your email"/>
<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>Hello,</p>
<p>Welcome to Talantology! Your account has been created.</p>
<p>To verify this account please <a href="${link}">click here</a>. After verifying your account, you can apply for jobs.</p>
<p>Thank You.</p>
</body>
</html>
]]></NODE>
<NODE name="TransformedContent" factory="String"><![CDATA[<p>Hello,</p><p>Welcome to Talantology! Your account has been created.</p><p>To verify this account please <a href="${link}">click here</a>. After verifying your account, you can apply for job.</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>
<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