Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PERFORMA_REPLICA
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhammad Usman
PERFORMA_REPLICA
Commits
b46f18a0
Commit
b46f18a0
authored
Sep 20, 2017
by
Harsh Shah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor review changes
parent
d5f156e0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
57 deletions
+39
-57
ForgotPasswordFP.java
cmsWebApp/src/performa/form/ForgotPasswordFP.java
+33
-46
ResendVerificationFP.java
cmsWebApp/src/performa/form/ResendVerificationFP.java
+0
-1
ResetPasswordFP.java
cmsWebApp/src/performa/form/ResetPasswordFP.java
+3
-6
Utils.java
cmsWebApp/src/performa/utils/Utils.java
+2
-3
my_details.jsp
cmsWebApp/webroot/extensions/adminportal/my_details.jsp
+1
-1
No files found.
cmsWebApp/src/performa/form/ForgotPasswordFP.java
View file @
b46f18a0
package
performa
.
form
;
package
performa
.
form
;
import
java.util.Date
;
import
java.util.*
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
oneit.business.content.Article
;
import
oneit.business.content.Article
;
import
oneit.components.ParticipantInitialisationContext
;
import
oneit.components.ParticipantInitialisationContext
;
import
oneit.email.ConfigurableEmailer
;
import
oneit.email.ConfigurableEmailer
;
import
oneit.logging.*
;
import
oneit.logging.*
;
import
oneit.net.LoopbackHTTP
;
import
oneit.net.LoopbackHTTP
;
import
oneit.objstore.ObjectTransaction
;
import
oneit.objstore.*
;
import
oneit.objstore.StorageException
;
import
oneit.objstore.rdbms.filters.EqualsFilter
;
import
oneit.objstore.rdbms.filters.EqualsFilter
;
import
oneit.security.SecUser
;
import
oneit.security.SecUser
;
import
oneit.servlets.forms.*
;
import
oneit.servlets.forms.*
;
import
oneit.servlets.process.*
;
import
oneit.servlets.process.*
;
import
oneit.utils.*
;
import
oneit.utils.*
;
import
oneit.utils.transform.MapTransform
;
import
performa.orm.*
;
import
oneit.utils.transform.param.ErrorTransform
;
import
performa.utils.*
;
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
;
public
class
ForgotPasswordFP
extends
SaveFP
public
class
ForgotPasswordFP
extends
SaveFP
{
{
private
static
LoggingArea
LOG
=
LoggingArea
.
createLoggingArea
(
"ForgotPasswordFP"
);
private
static
final
LoggingArea
LOG
=
LoggingArea
.
createLoggingArea
(
"ForgotPasswordFP"
);
protected
int
DEFAULT_PASSWORD_LENGTH
=
6
;
protected
int
DEFAULT_PASSWORD_LENGTH
=
6
;
protected
ConfigurableEmailer
resetCodeEmailer
;
protected
ConfigurableEmailer
resetCodeEmailer
;
@Override
@Override
public
SuccessfulResult
processForm
(
ORMProcessState
process
,
SubmissionDetails
submission
,
Map
params
)
throws
BusinessException
,
StorageException
public
SuccessfulResult
processForm
(
ORMProcessState
process
,
SubmissionDetails
submission
,
Map
params
)
throws
BusinessException
,
StorageException
{
{
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"
);
Job
job
=
(
Job
)
process
.
getAttribute
(
"Job"
);
Job
job
=
(
Job
)
process
.
getAttribute
(
"Job"
);
Debug
.
assertion
(
email
!=
null
,
"Email not avaialble"
);
Debug
.
assertion
(
StringUtils
.
subBlanks
(
email
)
!=
null
,
"Email not avaialble"
);
email
=
StringUtils
.
trim
(
email
);
email
=
StringUtils
.
trim
(
email
);
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"Started to send pasword reset link email."
,
email
);
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"Started to send pasword reset link email."
,
email
);
SecUser
secUser
=
SecUser
.
searchNAME
(
process
.
getTransaction
()
,
email
);
SecUser
secUser
=
SecUser
.
searchNAME
(
objTran
,
email
);
if
(
secUser
==
null
)
if
(
secUser
==
null
)
{
{
SecUser
[]
userSearch
=
SecUser
.
SearchByALL
().
andEmail
(
new
EqualsFilter
<>(
email
)).
search
(
objTran
);
SecUser
[]
userSearch
=
SecUser
.
SearchByALL
().
andEmail
(
new
EqualsFilter
<>(
email
)).
search
(
objTran
);
...
@@ -59,38 +49,42 @@ public class ForgotPasswordFP extends SaveFP
...
@@ -59,38 +49,42 @@ public class ForgotPasswordFP extends SaveFP
}
}
}
}
if
(
secUser
!=
null
)
if
(
secUser
!=
null
)
{
{
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"Inside ForgotPasswordFP for send reset pasword link mail to "
,
email
);
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"Inside ForgotPasswordFP for send reset pasword link mail to "
,
email
);
Map
emailParams
;
Map
emailParams
;
CompanyUser
companyUser
=
secUser
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
);
CompanyUser
companyUser
=
secUser
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
);
if
(
companyUser
!=
null
)
if
(
companyUser
!=
null
)
{
{
if
(
companyUser
.
getForgotPasswordKey
()
==
null
)
if
(
companyUser
.
getForgotPasswordKey
()
==
null
)
{
{
String
resetCode
=
new
RandomStringGen
().
generateHumanAlphaNum
(
new
Integer
(
DEFAULT_PASSWORD_LENGTH
)
);
String
resetCode
=
new
RandomStringGen
().
generateHumanAlphaNum
(
DEFAULT_PASSWORD_LENGTH
);
companyUser
.
setForgotPasswordKey
(
resetCode
);
companyUser
.
setForgotPasswordKey
(
resetCode
);
}
}
companyUser
.
setForgotPasswordMailSendDate
(
new
Date
());
companyUser
.
setForgotPasswordMailSendDate
(
new
Date
());
emailParams
=
CollectionUtils
.
mapEntry
(
"resetcode"
,
companyUser
.
getForgotPasswordKey
())
emailParams
=
CollectionUtils
.
mapEntry
(
"resetcode"
,
companyUser
.
getForgotPasswordKey
())
.
mapEntry
(
"url"
,
LoopbackHTTP
.
getRemoteAccessURL
()
.
mapEntry
(
"url"
,
LoopbackHTTP
.
getRemoteAccessURL
()
+
"/extensions/adminportal/reset_password.jsp"
+
"/extensions/adminportal/reset_password.jsp"
+
"?id="
+
companyUser
.
getID
()
+
"?id="
+
companyUser
.
getID
()
+
"&key="
+
companyUser
.
getForgotPasswordKey
()).
toMap
();
+
"&key="
+
companyUser
.
getForgotPasswordKey
()).
toMap
();
}
}
else
else
{
{
Candidate
candidate
=
secUser
.
getExtension
(
Candidate
.
REFERENCE_Candidate
);
Candidate
candidate
=
secUser
.
getExtension
(
Candidate
.
REFERENCE_Candidate
);
Article
applyJobArticle
=
WebUtils
.
getArticleByShortCut
(
objTran
,
WebUtils
.
APPLY_JOB
);
if
(
candidate
==
null
)
{
throw
new
BusinessException
(
"Sorry, we don't recognize that email address."
);
}
Article
applyJobArticle
=
WebUtils
.
getArticleByShortCut
(
objTran
,
WebUtils
.
APPLY_JOB
);
if
(
candidate
.
getForgotPasswordKey
()
==
null
)
if
(
candidate
.
getForgotPasswordKey
()
==
null
)
{
{
String
resetCode
=
new
RandomStringGen
().
generateHumanAlphaNum
(
new
Integer
(
DEFAULT_PASSWORD_LENGTH
)
);
String
resetCode
=
new
RandomStringGen
().
generateHumanAlphaNum
(
DEFAULT_PASSWORD_LENGTH
);
candidate
.
setForgotPasswordKey
(
resetCode
);
candidate
.
setForgotPasswordKey
(
resetCode
);
}
}
...
@@ -104,20 +98,13 @@ public class ForgotPasswordFP extends SaveFP
...
@@ -104,20 +98,13 @@ public class ForgotPasswordFP extends SaveFP
+
"&jid="
+
job
.
getID
()).
toMap
();
+
"&jid="
+
job
.
getID
()).
toMap
();
}
}
PrefixCompoundTransform
compoundTransform
=
new
PrefixCompoundTransform
();
ObjectTransform
transform
=
Utils
.
createCompoundTransform
(
emailParams
,
secUser
);
ObjectTransform
defaultTransform
=
new
MapTransform
(
emailParams
);
compoundTransform
.
setDefault
(
defaultTransform
);
compoundTransform
.
add
(
"user"
,
new
ORMTransform
(
secUser
));
ObjectTransform
transform
=
new
StringUtils
.
NullToBlankPostTransform
(
new
ErrorTransform
(
compoundTransform
));
try
try
{
{
resetCodeEmailer
.
sendMail
(
transform
,
new
String
[]
{
email
}
);
Utils
.
sendMail
(
resetCodeEmailer
,
transform
,
new
String
[]{
email
},
null
,
secUser
);
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"
Mail has been sent from "
+
ForgotPasswordFP
.
class
+
"
to :: "
,
email
);
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"
Reset code email sent
to :: "
,
email
);
}
}
catch
(
Exception
e
)
catch
(
Exception
e
)
{
{
...
...
cmsWebApp/src/performa/form/ResendVerificationFP.java
View file @
b46f18a0
...
@@ -25,7 +25,6 @@ public class ResendVerificationFP extends SaveFP
...
@@ -25,7 +25,6 @@ public class ResendVerificationFP extends SaveFP
public
SuccessfulResult
processForm
(
ORMProcessState
process
,
SubmissionDetails
submission
,
Map
params
)
throws
BusinessException
,
StorageException
public
SuccessfulResult
processForm
(
ORMProcessState
process
,
SubmissionDetails
submission
,
Map
params
)
throws
BusinessException
,
StorageException
{
{
HttpServletRequest
request
=
submission
.
getRequest
();
HttpServletRequest
request
=
submission
.
getRequest
();
String
nextPage
=
(
String
)
request
.
getAttribute
(
"nextPage"
);
CompanyUser
companyUser
=
(
CompanyUser
)
request
.
getAttribute
(
"CompanyUser"
);
CompanyUser
companyUser
=
(
CompanyUser
)
request
.
getAttribute
(
"CompanyUser"
);
LogMgr
.
log
(
CompanyUser
.
LOG
,
LogLevel
.
PROCESSING1
,
"Inside ResendVerificationFP resending verification email to company user : "
,
companyUser
);
LogMgr
.
log
(
CompanyUser
.
LOG
,
LogLevel
.
PROCESSING1
,
"Inside ResendVerificationFP resending verification email to company user : "
,
companyUser
);
...
...
cmsWebApp/src/performa/form/ResetPasswordFP.java
View file @
b46f18a0
...
@@ -15,7 +15,7 @@ import performa.utils.Utils;
...
@@ -15,7 +15,7 @@ import performa.utils.Utils;
public
class
ResetPasswordFP
extends
ORMProcessFormProcessor
public
class
ResetPasswordFP
extends
ORMProcessFormProcessor
{
{
private
static
LoggingArea
LOG
=
LoggingArea
.
createLoggingArea
(
"ResetPasswordFP"
);
private
static
final
LoggingArea
LOG
=
LoggingArea
.
createLoggingArea
(
"ResetPasswordFP"
);
@Override
@Override
...
@@ -25,19 +25,16 @@ public class ResetPasswordFP extends ORMProcessFormProcessor
...
@@ -25,19 +25,16 @@ public class ResetPasswordFP extends ORMProcessFormProcessor
CompanyUser
companyUser
=
user
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
);
CompanyUser
companyUser
=
user
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
);
Candidate
candidate
=
user
.
getExtension
(
Candidate
.
REFERENCE_Candidate
);
Candidate
candidate
=
user
.
getExtension
(
Candidate
.
REFERENCE_Candidate
);
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"Inside ResetPasswordFP user:"
,
user
,
" companyUser:"
,
companyUser
,
" candidate:"
,
candidate
);
if
(
companyUser
!=
null
)
if
(
companyUser
!=
null
)
{
{
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"Inside ResetPasswordFP for Company User reset pasword to "
,
user
);
companyUser
.
setForgotPasswordKey
(
null
);
companyUser
.
setForgotPasswordKey
(
null
);
}
}
else
if
(
candidate
!=
null
)
else
if
(
candidate
!=
null
)
{
{
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"Inside ResetPasswordFP for Candidate reset pasword to "
,
user
);
candidate
.
setForgotPasswordKey
(
null
);
candidate
.
setForgotPasswordKey
(
null
);
}
}
return
Utils
.
processSuccessfulLogin
(
process
,
submission
,
params
,
user
);
return
Utils
.
processSuccessfulLogin
(
process
,
submission
,
params
,
user
);
}
}
...
...
cmsWebApp/src/performa/utils/Utils.java
View file @
b46f18a0
...
@@ -5,8 +5,7 @@ import javax.activation.DataSource;
...
@@ -5,8 +5,7 @@ import javax.activation.DataSource;
import
javax.servlet.http.*
;
import
javax.servlet.http.*
;
import
oneit.appservices.config.ConfigMgr
;
import
oneit.appservices.config.ConfigMgr
;
import
oneit.business.content.Article
;
import
oneit.business.content.Article
;
import
oneit.email.ConfigurableArticleTemplateEmailer
;
import
oneit.email.*
;
import
oneit.email.ConfigurableEmailerException
;
import
oneit.logging.LogLevel
;
import
oneit.logging.LogLevel
;
import
oneit.logging.LogMgr
;
import
oneit.logging.LogMgr
;
import
oneit.logging.LoggingArea
;
import
oneit.logging.LoggingArea
;
...
@@ -305,7 +304,7 @@ public class Utils
...
@@ -305,7 +304,7 @@ public class Utils
}
}
public
static
void
sendMail
(
Configurable
ArticleTemplate
Emailer
emailer
,
ObjectTransform
finalTransform
,
String
[]
emails
,
DataSource
[]
attachments
,
BaseBusinessClass
bo
)
throws
ConfigurableEmailerException
public
static
void
sendMail
(
ConfigurableEmailer
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
));
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
"Sending Mail from Utils class to"
+
Arrays
.
toString
(
emails
));
...
...
cmsWebApp/webroot/extensions/adminportal/my_details.jsp
View file @
b46f18a0
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
<div class="tab-content">
<div class="tab-content">
<div class="tab-pane active" id="company-detail">
<div class="tab-pane active" id="company-detail">
<div class="tabpage-title">
<div class="tabpage-title">
My Det
ia
ls
My Det
ai
ls
</div>
</div>
<div class="form-group">
<div class="form-group">
<label><oneit:label GUIName="Email Address" /></label>
<label><oneit:label GUIName="Email Address" /></label>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment