Commit e0af020b by nilu

S35705423 # Client - Incoming Issues (raised by Client) #Error: "A value for…

S35705423 # Client - Incoming Issues (raised by Client) #Error: "A value for UserName already exists"
parent e17e0319
......@@ -15,6 +15,7 @@
<column name="google_address_text" type="String" nullable="true" length="300"/>
<column name="prefer_remote" type="Boolean" nullable="true"/>
<column name="happy_to_relocate" type="Boolean" nullable="true"/>
<column name="is_email_ingest" type="Boolean" nullable="true"/>
<column name="candidate_id" type="Long" length="11" nullable="false"/>
<column name="job_id" type="Long" length="11" nullable="false"/>
</NODE>
......
......@@ -15,6 +15,7 @@ CREATE TABLE tl_job_application (
google_address_text varchar(300) NULL,
prefer_remote char(1) NULL,
happy_to_relocate char(1) NULL,
is_email_ingest char(1) NULL,
candidate_id numeric(12) NOT NULL,
job_id numeric(12) NOT NULL
);
......
......@@ -16,6 +16,7 @@ CREATE TABLE tl_job_application (
google_address_text varchar2(300) NULL,
prefer_remote char(1) NULL,
happy_to_relocate char(1) NULL,
is_email_ingest char(1) NULL,
candidate_id number(12) NOT NULL,
job_id number(12) NOT NULL
);
......
......@@ -16,6 +16,7 @@ CREATE TABLE tl_job_application (
google_address_text varchar(300) NULL,
prefer_remote char(1) NULL,
happy_to_relocate char(1) NULL,
is_email_ingest char(1) NULL,
candidate_id numeric(12) NOT NULL,
job_id numeric(12) NOT NULL
);
......
package performa.form;
import java.util.Map;
import oneit.objstore.ObjectTransaction;
import oneit.objstore.StorageException;
import oneit.objstore.parser.BusinessObjectParser;
import oneit.security.SecUser;
import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.forms.SuccessfulResult;
import oneit.servlets.process.ORMProcessState;
import oneit.servlets.process.SaveFP;
import oneit.utils.BusinessException;
import oneit.utils.CollectionUtils;
import oneit.utils.Debug;
import oneit.utils.MultiException;
import oneit.utils.RandomStringGen;
import oneit.utils.StringUtils;
import performa.orm.Candidate;
import performa.orm.Job;
import performa.orm.JobApplication;
import performa.utils.Utils;
import javax.servlet.http.HttpServletRequest;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.logging.LoggingArea;
import oneit.servlets.security.SessionSecUserDecorator;
public class IdentifyMaskedUserFP extends SaveFP
{
private static final LoggingArea LOG = LoggingArea.createLoggingArea("IdentifyMaskedUserFP");
@Override
public void validate(ORMProcessState process, SubmissionDetails submission, MultiException exceptions, Map params) throws StorageException
{
HttpServletRequest request = submission.getRequest();
Job job = (Job) request.getAttribute("Job");
Debug.assertion(job != null, "BO not avaialble");
Candidate candidate = (Candidate) request.getAttribute("Candidate");
SecUser secUser = candidate.getUser();
BusinessObjectParser.assertFieldCondition(secUser.getEmail() != null , job, Job.FIELD_Email, "mandatory", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(StringUtils.isEmailAddress(secUser.getEmail()), job, Job.FIELD_Email, "invalid", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(secUser.getFirstName() != null, secUser, SecUser.FIELD_FirstName, "mandatory", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(secUser.getLastName() != null, secUser, SecUser.FIELD_LastName, "mandatory", exceptions, true, request);
if(candidate.isEmailFound())
{
String password = (String) request.getParameter("password");
BusinessObjectParser.assertFieldCondition(password != null, secUser, SecUser.FIELD_Password, "mandatory", 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();
Candidate candidate = (Candidate) request.getAttribute("Candidate");
JobApplication jobApplication = (JobApplication) request.getAttribute("JobApplication");
String password = (String) request.getParameter("password");
Job job = (Job) request.getAttribute("Job");
LogMgr.log(LOG, LogLevel.PROCESSING1, "Started IdentifyMaskedUserFP", candidate);
if(candidate.isTrue(candidate.getIsEmailIngest()) && candidate.isTrue(candidate.getIsMaskedEmail()))
{
SecUser old = (SecUser) candidate.getUser().getEarliestBackup();
String userEmail = candidate.getUser().getEmail();
if(CollectionUtils.equals(old.getEmail(), candidate.getUser().getEmail()))
{
throw new BusinessException("Please enter a valid email address");
}
if(Utils.emailExists(objTran, userEmail))
{
LogMgr.log(LOG, LogLevel.PROCESSING1, "User account already exists with the entered email", candidate, "email: " , userEmail);
if(Utils.isCompanyUserEmailFound(objTran, userEmail))
{
throw new BusinessException("This email address is already in use by a Hiring Team account.");
}
SecUser newUser = candidate.getUser();
SecUser existingUser = SecUser.searchNAME(objTran, userEmail);
Candidate existingCandidate = existingUser.getExtension(Candidate.REFERENCE_Candidate);
if(!existingUser.checkPassword(password))
{
throw new BusinessException("Invalid Password. Please try again");
}
try
{
//Ideally should be managed with uniqueGroup, but uniqueGroup doesnt work without atleast 1 attribute
JobApplication.searchCandidateJob(process.getTransaction(), candidate, job); //It will throw RuntimeException when more than 1 record found.
}
catch(RuntimeException ex)
{
throw new BusinessException("You have already applied for this job.");
}
jobApplication.setCandidate(existingCandidate);
existingUser.setFirstName(newUser.getFirstName());
existingUser.setLastName(newUser.getLastName());
existingCandidate.setKnownAsAlias(old.getEmail());
candidate.delete();
newUser.delete();
request.getSession().setAttribute (SecUser.SEC_USER_ID, existingUser);
request.getSession().setAttribute (SessionSecUserDecorator.REFRESH_SECURITY, Boolean.TRUE);
}
else
{
//set new verification key as email changed
candidate.setVerificationKey(new RandomStringGen().generateAlphaNum(6));
candidate.getUser().setUserName(candidate.getUser().getEmail());
candidate.setIsMaskedEmail(false);
candidate.setKnownAsAlias(old.getEmail());
}
}
LogMgr.log(LOG, LogLevel.PROCESSING1, "Finish IdentifyMaskedUserFP");
return super.processForm(process, submission, params);
}
}
......@@ -130,25 +130,9 @@ public class SendVerificationMailFP extends SaveFP
}
else
{
if(candidate.isTrue(candidate.getIsEmailIngest()))
if(candidate.isTrue(candidate.getIsEmailIngest()) || jobApplication.getApplicationStatus() == ApplicationStatus.POST_INGEST)
{
if(candidate.isTrue(candidate.getIsMaskedEmail()))
{
SecUser old = (SecUser) candidate.getUser().getEarliestBackup();
if(CollectionUtils.equals(old.getEmail(), candidate.getUser().getEmail()))
{
throw new BusinessException("Please enter a valid email address");
}
//set new verification key as email changed
candidate.setVerificationKey(new RandomStringGen().generateAlphaNum(6));
candidate.getUser().setUserName(candidate.getUser().getEmail());
candidate.setIsMaskedEmail(false);
candidate.setKnownAsAlias(old.getEmail());
}
else
if(candidate.isFalse(candidate.getIsMaskedEmail()))
{
candidate.setIsAccountVerified(true);
}
......
......@@ -13,6 +13,7 @@ import oneit.objstore.ObjectTransaction;
import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.objstore.rdbms.filters.IsNotNullFilter;
import oneit.objstore.utils.ObjstoreUtils;
import oneit.security.SecUser;
import oneit.servlets.objstore.MessageSourceDecorator;
import oneit.servlets.process.ORMProcessState;
import oneit.utils.BusinessException;
......@@ -200,4 +201,19 @@ public class Candidate extends BaseCandidate
{
return !isTrue(getIsAccountVerified()) && isTrue(getIsEmailIngest());
}
public Boolean isEmailFound()
{
if(getUser() != null && getUser().getEmail() != null)
{
SecUser user = SecUser.searchNAME(getTransaction(), getUser().getEmail().toLowerCase());
if(user != null && user.getExtension(Candidate.REFERENCE_Candidate) != null && user.getExtension(Candidate.REFERENCE_Candidate).getIsAccountVerified())
{
return Boolean.TRUE;
}
}
return Boolean.FALSE;
}
}
\ No newline at end of file
......@@ -30,6 +30,7 @@
<ATTRIB name="GoogleAddressText" type="String" dbcol="google_address_text" length="300"/>
<ATTRIB name="PreferRemote" type="Boolean" dbcol="prefer_remote" defaultValue="Boolean.FALSE"/>
<ATTRIB name="HappyToRelocate" type="Boolean" dbcol="happy_to_relocate"/>
<ATTRIB name="IsEmailIngest" type="Boolean" dbcol="is_email_ingest" defaultValue="Boolean.FALSE"/>
<SINGLEREFERENCE name="Candidate" type="Candidate" dbcol="candidate_id" backreferenceName="JobApplications" mandatory="true"/>
<SINGLEREFERENCE name="Job" type="Job" dbcol="job_id" backreferenceName="JobApplications" mandatory="true"/>
......
......@@ -376,6 +376,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
JobApplication jobApplication = JobApplication.createNewApplication(candidate, job);
jobApplication.setApplicationStatus(ApplicationStatus.POST_INGEST);
jobApplication.setIsEmailIngest(true);
if(contents.size() > 0)
{
......@@ -427,6 +428,7 @@ public class PerformaEmailFetcher implements Runnable, InitialisationParticipant
JobApplication jobApplication = JobApplication.createNewApplication(candidate, job);
jobApplication.setApplicationStatus(ApplicationStatus.POST_INGEST);
jobApplication.setIsEmailIngest(true);
if(contents.size() > 0)
{
......
......@@ -80,7 +80,7 @@
.mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).mapEntry("Applications", applications).toMap())
.toMap() %>">
<%
if(jobApplication.isTrue(candidate.getIsEmailIngest()))
if(jobApplication.isTrue(jobApplication.getIsEmailIngest()))
{
%>
<span style="padding-right: 5px;"><img src="images/email-ingest-icon.jpg"></span>
......
<?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">tl_job_application</tableName>
<column name="is_email_ingest" type="Boolean" nullable="true"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
UPDATE tl_job_application SET is_email_ingest = 'Y' FROM oneit_sec_user_extension WHERE oneit_sec_user_extension.object_id = tl_job_application.candidate_id AND oneit_sec_user_extension.is_email_ingest = 'Y';
\ No newline at end of file
......@@ -4,6 +4,7 @@
<NODE name="dynamic_content_form::APPLICANT_PORTAL" factory="Participant">
<FORM name="*.signIn" factory="Participant" class="performa.form.SignInCandidateFP"/>
<FORM name="*.verifyIdentity" factory="Participant" class="performa.form.VerifyIdentityFP"/>
<FORM name="*.identifyUser" factory="Participant" class="performa.form.IdentifyMaskedUserFP"/>
<FORM name="*.completeApplication" factory="Participant" class="performa.form.CompleteApplicationFP"/>
<FORM name="*.validateApplication" factory="Participant" class="performa.form.ValidateApplicationFP"/>
<FORM name="*.saveAndExitExperienece" factory="Participant" class="performa.form.SaveAndExitExperienceFP"/>
......
......@@ -25,6 +25,7 @@
<RenderMode name="Page" preIncludeJSP="extensions/applicantportal/job_overview.jsp"/>
<RenderMode name="SignIn" preIncludeJSP="extensions/applicantportal/sign_in.jsp"/>
<RenderMode name="VerifyIdentity" preIncludeJSP="extensions/applicantportal/verify_identity.jsp"/>
<RenderMode name="MaskedIdentity" preIncludeJSP="extensions/applicantportal/masked_identity.jsp"/>
<RenderMode name="VerificationSent" preIncludeJSP="extensions/applicantportal/verification_sent.jsp"/>
<RenderMode name="ForgotPassword" preIncludeJSP="extensions/applicantportal/forgot_password.jsp"/>
<RenderMode name="ResetPassword" preIncludeJSP="extensions/applicantportal/reset_password.jsp"/>
......
......@@ -32,7 +32,11 @@
String navigateTo = WebUtils.getSamePageInRenderMode(request, "SignIn") + "&UserName=" + secUser.getEmail();
if((loggedInUser != null && loggedInUser == secUser) || candidate.isUnverifiedEmailIngestUser() || !candidate.isTrue(candidate.getIsPasswordChanged()))
if(candidate.isUnverifiedEmailIngestUser() && candidate.isTrue(candidate.getIsMaskedEmail()))
{
navigateTo = WebUtils.getSamePageInRenderMode(request,"MaskedIdentity");
}
else if((loggedInUser != null && loggedInUser == secUser) || candidate.isUnverifiedEmailIngestUser() || !candidate.isTrue(candidate.getIsPasswordChanged()))
{
navigateTo = WebUtils.getSamePageInRenderMode(request,"VerifyIdentity");
}
......
<%@ page extends="oneit.servlets.jsp.JSPInclude" %>
<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/inc/stdcms.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<oneit:dynIncluded>
<%
boolean toRedirect = GenericObjDF.getOrCreateObject (request, "Job", Job.REFERENCE_Job);
Job job = (Job) process.getAttribute("Job");
Debug.assertion(job != null && !toRedirect, "Invalid job in applicant portal");
SecUser secUser = SecUser.getTXUser(transaction);
Debug.assertion(secUser != null, "Invalid candidate in applicant portal");
Candidate candidate = secUser.getExtension(Candidate.REFERENCE_Candidate);
Debug.assertion(candidate != null, "Invalid candidate in applicant portal");
String successPage = WebUtils.getSamePageInRenderMode(request, "VerifyIdentity") + "&JobID=" + job.getID();
JobApplication jobApplication = JobApplication.searchCandidateJob(transaction, candidate, job);
jobApplication.setIsEmailIngest(true);
process.setAttribute("JobApplication", jobApplication);
%>
<oneit:script>
<oneit:script src="/scripts/password_strength_lightweight.js"/>
</oneit:script>
<style>
button[disabled] {
opacity: 0.6;
background-color: #0582ba;
}
.email input[name$="Email"] {
opacity: 0;
position: absolute;
}
</style>
<script type="text/javascript">
$(document.body).addClass('bg-color');
var interval ;
$(document).ready(function() {
recalcFunction = setupRecalc ($("form#signIn"), {'recalcOnError':true});
interval = setInterval(function() { validate(); }, 500);
validate();
$('input').on('change keyup', function() { validate(); });
});
function validate() {
var empty = false;
$('input[required]').each(function() {
if ($( this ).val() == '') {
empty = true;
if ($( this ).css('background-color') == 'rgb(250, 255, 189)') {
empty = false;
}
}
});
if (empty) {
$('.verify-btn').attr('disabled', 'disabled');
} else {
$('.verify-btn').removeAttr('disabled');
clearInterval(interval);
}
}
</script>
<oneit:form name="signIn" method="post" enctype="multipart/form-data">
<oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/>
<div class="apply-job-logo-header signinpage">
<div class="box-sizing-border-box">
<div class="logo-img">
<%
BinaryContent logo = job.getLogo();
if(logo != null)
{
int logoHeight = 45;
%>
<tagfile:img src="<%= ThumbnailUtils.filterImage(DiskFileBinaryContent.getRelativeURL(logo), "KEEP", new ScaleWithin (0, logoHeight)) %>" />
<%
}
%>
</div>
<div class="header-title">
<%= job.getTeamName() %>
</div>
</div>
</div>
<div class="main-verify-identity">
<div class="pl-confirm text-center">Please confirm your details to continue</div>
<div class="main-box-layout main-verify-step-2">
<div class="form-group text-left">
<label>Email Address</label>
<oneit:ormInput obj="<%= secUser %>" type="text" attributeName="Email" cssClass="form-control" style="text-transform: lowercase" required="true"/>
</div>
<div class="row">
<div class="form-group text-left col-sm-6 col-xs-12">
<label><oneit:ormlabel obj="<%= secUser %>" field="FirstName" /></label>
<oneit:ormInput obj="<%= secUser %>" type="text" attributeName="FirstName" cssClass="form-control second-style" required="true"/>
</div>
<div class="form-group text-left col-sm-6 col-xs-12">
<label><oneit:ormlabel obj="<%= secUser %>" field="LastName" /></label>
<oneit:ormInput obj="<%= secUser %>" type="text" attributeName="LastName" cssClass="form-control second-style" required="true"/>
</div>
</div>
<oneit:recalcClass htmlTag="div" classScript="candidate.isEmailFound() ? 'show': 'hide'" candidate="<%= candidate %>" id="password-fileds">
<div class="form-group text-left">
<label>Password</label>
<input type="password" class="form-control" name="password" required>
</div>
</oneit:recalcClass>
<div class="text-center">
<oneit:button value="Submit" name="identifyUser" cssClass="box-btn send-link-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", successPage)
.mapEntry("Job",job)
.mapEntry("Candidate",candidate)
.mapEntry("JobApplication",jobApplication)
.mapEntry(NotificationUtils.DISPLAY_NOTIFICATION_PARAM, false)
.toMap() %>"/>
</div>
</div>
</div>
</oneit:form>
</oneit:dynIncluded>
......@@ -163,7 +163,7 @@
<div class="form-group text-left">
<label>Email Address</label>
<%
if(secUser.getEmail() == null || (candidate.isUnverifiedEmailIngestUser() && candidate.isTrue(candidate.getIsMaskedEmail())))
if(secUser.getEmail() == null)
{
%>
<oneit:ormInput obj="<%= secUser %>" type="text" attributeName="Email" cssClass="form-control" style="text-transform: lowercase" required="true"/>
......@@ -201,7 +201,6 @@
<label>Confirm password</label>
<oneit:input type="password" name="<%= passkey + 2 %>" class="form-control second-style reset-pw"/>
</div>
<%
}
%>
......
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