Commit 4ed5f0e3 by Nilu

reset password applicant portal

parent 37f0a136
...@@ -21,6 +21,7 @@ import oneit.utils.transform.param.ORMTransform; ...@@ -21,6 +21,7 @@ import oneit.utils.transform.param.ORMTransform;
import oneit.utils.transform.param.PrefixCompoundTransform; import oneit.utils.transform.param.PrefixCompoundTransform;
import performa.orm.Candidate; import performa.orm.Candidate;
import performa.orm.CompanyUser; import performa.orm.CompanyUser;
import performa.orm.Job;
import performa.utils.WebUtils; import performa.utils.WebUtils;
...@@ -37,8 +38,8 @@ public class ForgotPasswordFP extends SaveFP ...@@ -37,8 +38,8 @@ public class ForgotPasswordFP extends SaveFP
HttpServletRequest request = submission.getRequest(); HttpServletRequest request = submission.getRequest();
ObjectTransaction objTran = process.getTransaction(); ObjectTransaction objTran = process.getTransaction();
String email = (String) request.getParameter("email"); String email = (String) request.getParameter("email");
String nextPage = (String) request.getAttribute("nextPage"); Job job = (Job) process.getAttribute("Job");
Debug.assertion(email != null, "Email not avaialble"); Debug.assertion(email != null, "Email not avaialble");
email = StringUtils.trim(email); email = StringUtils.trim(email);
...@@ -96,10 +97,11 @@ public class ForgotPasswordFP extends SaveFP ...@@ -96,10 +97,11 @@ public class ForgotPasswordFP extends SaveFP
candidate.setForgotPasswordMailSendDate(new Date()); candidate.setForgotPasswordMailSendDate(new Date());
emailParams = CollectionUtils.mapEntry("resetcode", candidate.getForgotPasswordKey()) emailParams = CollectionUtils.mapEntry("resetcode", candidate.getForgotPasswordKey())
.mapEntry("url", LoopbackHTTP.getRemoteAccessURL(request) .mapEntry("url", LoopbackHTTP.getRemoteAccessURL(request)
+ applyJobArticle.getLink(request, CollectionUtils.EMPTY_MAP, "/") + applyJobArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", WebUtils.RESET_PASSWORD).toMap(), "/")
+ "?id=" + candidate.getID() + "&id=" + candidate.getID()
+ "&key=" + candidate.getForgotPasswordKey()).toMap(); + "&key=" + candidate.getForgotPasswordKey()
+ "&jid=" + job.getID()).toMap();
} }
PrefixCompoundTransform compoundTransform = new PrefixCompoundTransform(); PrefixCompoundTransform compoundTransform = new PrefixCompoundTransform();
...@@ -129,9 +131,7 @@ public class ForgotPasswordFP extends SaveFP ...@@ -129,9 +131,7 @@ public class ForgotPasswordFP extends SaveFP
throw new BusinessException("Sorry, we don't recognize that email address."); throw new BusinessException("Sorry, we don't recognize that email address.");
} }
process.completeAndRestart(); return super.processForm(process, submission, params);
return new ProcessRedirectResult(nextPage, new String[0]);
} }
......
...@@ -4852,6 +4852,10 @@ label, label .label-title span { ...@@ -4852,6 +4852,10 @@ label, label .label-title span {
font-size: 26px; font-size: 26px;
} }
.smaller-face{
width: 20.2px;
}
.mob-smile-face{ .mob-smile-face{
position: absolute; position: absolute;
width: 16.2px; width: 16.2px;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<RenderMode name="Page" preIncludeJSP="extensions/applicantportal/job_overview.jsp"/> <RenderMode name="Page" preIncludeJSP="extensions/applicantportal/job_overview.jsp"/>
<RenderMode name="SignIn" preIncludeJSP="extensions/applicantportal/sign_in.jsp"/> <RenderMode name="SignIn" preIncludeJSP="extensions/applicantportal/sign_in.jsp"/>
<RenderMode name="ForgotPassword" preIncludeJSP="extensions/applicantportal/forgot_password.jsp"/> <RenderMode name="ForgotPassword" preIncludeJSP="extensions/applicantportal/forgot_password.jsp"/>
<RenderMode name="ResetPassword" preIncludeJSP="extensions/applicantportal/forgot_password.jsp"/> <RenderMode name="ResetPassword" preIncludeJSP="extensions/applicantportal/reset_password.jsp"/>
<RenderMode name="ResetPasswordSent" preIncludeJSP="extensions/applicantportal/reset_password_sent.jsp"/> <RenderMode name="ResetPasswordSent" preIncludeJSP="extensions/applicantportal/reset_password_sent.jsp"/>
</NODE> </NODE>
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
<oneit:dynIncluded> <oneit:dynIncluded>
<script type="text/javascript"> <script type="text/javascript">
$(document.body).addClass('bg-color');
$(document).ready(function() { $(document).ready(function() {
validate(); validate();
$('input').on('change keyup', function() { validate() }); $('input').on('change keyup', function() { validate() });
...@@ -53,9 +55,11 @@ ...@@ -53,9 +55,11 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<oneit:button value="Send" name="gotoPage" cssClass="box-btn send-btn" <oneit:button value="Send" name="forgotPassword" cssClass="box-btn send-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", WebUtils.getSamePageInRenderMode(request, "ResetPasswordSent")) requestAttribs="<%= CollectionUtils.mapEntry("nextPage", WebUtils.getSamePageInRenderMode(request, "ResetPasswordSent"))
.toMap() %>"/> .mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry ("attribNamesToRestore", Collections.singleton("Job"))
.toMap() %>"/>
</div> </div>
</div> </div>
</oneit:form> </oneit:form>
......
...@@ -8,109 +8,114 @@ ...@@ -8,109 +8,114 @@
<% <%
ORMProcessState process = (ORMProcessState)ProcessDecorator.getDefaultProcess(request); ORMProcessState process = (ORMProcessState)ProcessDecorator.getDefaultProcess(request);
ObjectTransaction objTran = process.getTransaction ();
String candidateID = (String) process.getAttribute("candidateID"); //request.getParameter("id"); String candidateID = (String) process.getAttribute("candidateID"); //request.getParameter("id");
String forgotpasswordCode = (String) process.getAttribute("forgotpasswordCode"); //request.getParameter("key"); String forgotpasswordCode = (String) process.getAttribute("forgotpasswordCode"); //request.getParameter("key");
SecUser user = (SecUser) process.getAttribute("SecUser"); SecUser user = (SecUser) process.getAttribute("SecUser");
Article home = WebUtils.getArticleByShortCut(process.getTransaction(), WebUtils.ADMIN_HOME); String nextPage = WebUtils.getArticleLink(request, objTran, WebUtils.JOB_APPLICATION, "SignIn");
String nextPage = home.getLink(request); Job job = (Job) process.getAttribute("Job");
if(request.getParameter("id")!=null) if(request.getParameter("id")!= null)
{ {
candidateID = request.getParameter("id"); candidateID = request.getParameter("id");
process.setAttribute("candidateID", candidateID); process.setAttribute("candidateID", candidateID);
} }
if(request.getParameter("key")!=null) if(request.getParameter("key")!= null)
{ {
forgotpasswordCode = request.getParameter("key"); forgotpasswordCode = request.getParameter("key");
process.setAttribute("forgotpasswordCode", forgotpasswordCode); process.setAttribute("forgotpasswordCode", forgotpasswordCode);
} }
if(StringUtils.subBlanks(companyUserID) != null) if(request.getParameter("jid")!= null)
{
String jobID = request.getParameter("jid");
job = Job.getJobByID(objTran, Long.parseLong(jobID));
process.setAttribute("Job", job);
}
if(StringUtils.subBlanks(candidateID) != null)
{ {
Canddate candidate = CompanyUser.getCandidateForForgotPassword(process.getTransaction(), candidateID, forgotpasswordCode); Candidate candidate = Candidate.getCandidateForForgotPassword(objTran, candidateID, forgotpasswordCode);
if(candidate != null) if(candidate != null)
{ {
user = candidate.getUser(); user = candidate.getUser();
// if(StringUtils.subBlanks(forgotpasswordCode) != null)
// {
// RandomStringGen random = new RandomStringGen();
//
// user.setAttribute("md5:Password", random.generateAlphaNum(8));
// }
process.setAttribute("SecUser", user); process.setAttribute("SecUser", user);
} }
} }
%> %>
<script type="text/javascript">
$(document.body).addClass('bg-color');
<script type="text/javascript"> $(document).ready(function() {
$(document).ready(function() { validate();
validate(); $('input').on('change keyup', function() { validate() });
$('input').on('change keyup', function() { validate() });
});
function validate() {
var empty = false;
$('.password-field').each(function() {
if ( $.trim($( this ).val()) == '') {
empty = true;
}
}); });
if (empty) { function validate() {
$('.reset-btn').attr('disabled', 'disabled'); var empty = false;
} else { $('.password-field').each(function() {
$('.reset-btn').removeAttr('disabled'); if ( $.trim($( this ).val()) == '') {
empty = true;
}
});
if (empty) {
$('.reset-btn').attr('disabled', 'disabled');
} else {
$('.reset-btn').removeAttr('disabled');
}
} }
} </script>
</script> <style>
<style> button[disabled] {
button[disabled] { opacity: 0.6;
opacity: 0.6; background-color: #0582ba;
background-color: #0582ba; }
} </style>
</style> <div class="main-verify-identity">
<div class="login-logo"><img src="<%= request.getContextPath() %>/images/logo.svg" /></div>
<oneit:form name="resetPassword" method="post">
<oneit:form name="resetPassword" method="post"> <oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/>
<oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/>
<% <%
if(user!=null) if(user!=null)
{ {
String key = Utils.getPwdKeyOfSecUser(request, user, true); String key = Utils.getPwdKeyOfSecUser(request, user, true);
%> %>
<div class="main-box-layout login-box"> <div class="main-box-layout login-box">
<div class="text-left"> <div class="text-left">
<p > <p >
Please enter a new password below. Please enter a new password below.
</p> </p>
</div> </div>
<div>&nbsp;</div> <div>&nbsp;</div>
<div class="form-group text-left"> <div class="form-group text-left">
<label>Password *</label> <label>Password *</label>
<oneit:input type="password" name="<%= key %>" class="form-control password-field"/> <oneit:input type="password" name="<%= key %>" class="form-control password-field"/>
</div> <!-- form-group --> </div> <!-- form-group -->
<div class="form-group text-left"> <div class="form-group text-left">
<label>Confirm Password *</label> <label>Confirm Password *</label>
<oneit:input type="password" name="<%= key + 2 %>" class="form-control password-field"/> <oneit:input type="password" name="<%= key + 2 %>" class="form-control password-field"/>
</div> <!-- form-group --> </div> <!-- form-group -->
<div class="col-sm-12"> <div class="col-sm-12">
<oneit:button value="Set New Password" name="resetPassword" cssClass="box-btn reset-btn" <oneit:button value="Set New Password" name="resetPassword" cssClass="box-btn reset-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage).toMap() %>"/> requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage + "&JobID=" + job.getID().toString())
.toMap() %>"/>
</div>
</div> </div>
</div> <%
<% }
} else
else {
{ %>
%> <h3 class="text-danger">Invalid User or this link has been expired, generate new link to access this page.</h3>
<h3 class="text-danger">Invalid User or this link has been expired, generate new link to access this page.</h3> <%
<% }
} %>
%> </oneit:form>
</oneit:form> </div>
</oneit:dynIncluded> </oneit:dynIncluded>
\ No newline at end of file
...@@ -5,13 +5,17 @@ ...@@ -5,13 +5,17 @@
<%@ include file="/extensions/performa/inc/stdimports.jsp" %> <%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<oneit:dynIncluded> <oneit:dynIncluded>
<script type="text/javascript">
$(document.body).addClass('bg-color');
</script>
<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>
<div class="main-box-layout login-box"> <div class="main-box-layout login-box">
<div class="text-left"> <div>
<p> <p>
Enter your email address below. If we find a matching account, then you'll receive an email with a password reset link. Sent! Check your email now.<span><img class="smile-face smaller-face"src="images/smile-face.png" /></span>
</p> </p>
</div> </div>
</div> </div>
......
<?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="forgot_password_mail_send_date" type="Date" nullable="true"/>
<column name="forgot_password_key" type="String" nullable="true" length="10"/>
</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