Commit 4ed5f0e3 by Nilu

reset password applicant portal

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