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
d5f156e0
Commit
d5f156e0
authored
Sep 20, 2017
by
Nilu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
admin portal forgot password modifications
parent
2ff58003
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
245 additions
and
20 deletions
+245
-20
BaseCompanyUser.java
cmsWebApp/src/performa/orm/BaseCompanyUser.java
+177
-0
CompanyUser.java
cmsWebApp/src/performa/orm/CompanyUser.java
+14
-0
CompanyUser.xml
cmsWebApp/src/performa/orm/CompanyUser.xml
+1
-0
common.css
cmsWebApp/webroot/css/common.css
+6
-0
forgot_password.jsp
cmsWebApp/webroot/extensions/adminportal/forgot_password.jsp
+47
-20
No files found.
cmsWebApp/src/performa/orm/BaseCompanyUser.java
View file @
d5f156e0
...
...
@@ -49,6 +49,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
public
static
final
String
FIELD_VerificationMailSendDate
=
"VerificationMailSendDate"
;
public
static
final
String
FIELD_VerificationKey
=
"VerificationKey"
;
public
static
final
String
FIELD_IsAccountVerified
=
"IsAccountVerified"
;
public
static
final
String
FIELD_Email
=
"Email"
;
public
static
final
String
FIELD_Password
=
"Password"
;
public
static
final
String
FIELD_ConfirmPassword
=
"ConfirmPassword"
;
public
static
final
String
SINGLEREFERENCE_Company
=
"Company"
;
...
...
@@ -68,6 +69,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
private
static
final
DefaultAttributeHelper
<
CompanyUser
>
HELPER_VerificationMailSendDate
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
CompanyUser
>
HELPER_VerificationKey
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
CompanyUser
>
HELPER_IsAccountVerified
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
CompanyUser
>
HELPER_Email
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
CompanyUser
>
HELPER_Password
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
CompanyUser
>
HELPER_ConfirmPassword
=
DefaultAttributeHelper
.
INSTANCE
;
...
...
@@ -80,6 +82,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
private
Date
_VerificationMailSendDate
;
private
String
_VerificationKey
;
private
Boolean
_IsAccountVerified
;
private
String
_Email
;
private
String
_Password
;
private
String
_ConfirmPassword
;
...
...
@@ -95,6 +98,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
private
static
final
Map
ATTRIBUTES_METADATA_CompanyUser
=
new
HashMap
();
// Arrays of validators for each attribute
private
static
final
AttributeValidator
[]
FIELD_Email_Validators
;
private
static
final
AttributeValidator
[]
FIELD_Password_Validators
;
private
static
final
AttributeValidator
[]
FIELD_ConfirmPassword_Validators
;
private
static
final
AttributeValidator
[]
FIELD_ForgotPasswordMailSendDate_Validators
;
...
...
@@ -119,6 +123,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
Map
validatorMapping
=
((
Map
)
ConfigMgr
.
getConfigObject
(
"CONFIG.ORMVALIDATOR"
,
"ValidatorMapping"
));
setupAssocMetaData_Company
();
FIELD_Email_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_Email
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_Password_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_Password
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_ConfirmPassword_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_ConfirmPassword
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_ForgotPasswordMailSendDate_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_ForgotPasswordMailSendDate
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
...
...
@@ -158,6 +163,24 @@ public abstract class BaseCompanyUser extends SecUserExtension
// Meta Info setup
private
static
List
setupAttribMetaData_Email
(
Map
validatorMapping
)
{
Map
metaInfo
=
new
HashMap
();
metaInfo
.
put
(
"name"
,
"Email"
);
metaInfo
.
put
(
"type"
,
"String"
);
metaInfo
.
put
(
"validators"
,
"Email"
);
LogMgr
.
log
(
BUSINESS_OBJECTS
,
LogLevel
.
DEBUG2
,
"Metadata for CompanyUser.Email:"
,
metaInfo
);
ATTRIBUTES_METADATA_CompanyUser
.
put
(
FIELD_Email
,
Collections
.
unmodifiableMap
(
metaInfo
));
List
validators
=
BaseBusinessClass
.
getAttribValidators
(
CompanyUser
.
class
,
"Email"
,
metaInfo
,
validatorMapping
);
LogMgr
.
log
(
BUSINESS_OBJECTS
,
LogLevel
.
DEBUG1
,
"Validators for CompanyUser.Email:"
,
validators
);
return
validators
;
}
// Meta Info setup
private
static
List
setupAttribMetaData_Password
(
Map
validatorMapping
)
{
Map
metaInfo
=
new
HashMap
();
...
...
@@ -358,6 +381,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
_VerificationMailSendDate
=
(
Date
)(
HELPER_VerificationMailSendDate
.
initialise
(
_VerificationMailSendDate
));
_VerificationKey
=
(
String
)(
HELPER_VerificationKey
.
initialise
(
_VerificationKey
));
_IsAccountVerified
=
(
Boolean
)(
Boolean
.
FALSE
);
_Email
=
(
String
)(
HELPER_Email
.
initialise
(
_Email
));
_Password
=
(
String
)(
HELPER_Password
.
initialise
(
_Password
));
_ConfirmPassword
=
(
String
)(
HELPER_ConfirmPassword
.
initialise
(
_ConfirmPassword
));
}
...
...
@@ -1073,6 +1097,104 @@ public abstract class BaseCompanyUser extends SecUserExtension
}
/**
* Get the attribute Email
*/
public
String
getEmail
()
{
assertValid
();
String
valToReturn
=
_Email
;
for
(
CompanyUserBehaviourDecorator
bhd
:
CompanyUser_BehaviourDecorators
)
{
valToReturn
=
bhd
.
getEmail
((
CompanyUser
)
this
,
valToReturn
);
}
return
valToReturn
;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected
void
preEmailChange
(
String
newEmail
)
throws
FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected
void
postEmailChange
()
throws
FieldException
{
}
public
FieldWriteability
getWriteability_Email
()
{
return
getFieldWritabilityUtil
(
FieldWriteability
.
TRUE
);
}
/**
* Set the attribute Email. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public
void
setEmail
(
String
newEmail
)
throws
FieldException
{
boolean
oldAndNewIdentical
=
HELPER_Email
.
compare
(
_Email
,
newEmail
);
try
{
for
(
CompanyUserBehaviourDecorator
bhd
:
CompanyUser_BehaviourDecorators
)
{
newEmail
=
bhd
.
setEmail
((
CompanyUser
)
this
,
newEmail
);
oldAndNewIdentical
=
HELPER_Email
.
compare
(
_Email
,
newEmail
);
}
if
(
FIELD_Email_Validators
.
length
>
0
)
{
Object
newEmailObj
=
HELPER_Email
.
toObject
(
newEmail
);
if
(
newEmailObj
!=
null
)
{
int
loopMax
=
FIELD_Email_Validators
.
length
;
Map
metadata
=
(
Map
)
ATTRIBUTES_METADATA_CompanyUser
.
get
(
FIELD_Email
);
for
(
int
v
=
0
;
v
<
loopMax
;
++
v
)
{
FIELD_Email_Validators
[
v
].
checkAttribute
(
this
,
FIELD_Email
,
metadata
,
newEmailObj
);
}
}
}
}
catch
(
FieldException
e
)
{
if
(!
oldAndNewIdentical
)
{
e
.
setWouldModify
();
}
throw
e
;
}
if
(!
oldAndNewIdentical
)
{
assertValid
();
Debug
.
assertion
(
getWriteability_Email
()
!=
FieldWriteability
.
FALSE
,
"Field Email is not writeable"
);
preEmailChange
(
newEmail
);
markFieldChange
(
FIELD_Email
);
_Email
=
newEmail
;
postFieldChange
(
FIELD_Email
);
postEmailChange
();
}
}
/**
* Get the attribute Password
*/
public
String
getPassword
()
...
...
@@ -1797,6 +1919,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
_VerificationMailSendDate
=
sourceCompanyUser
.
_VerificationMailSendDate
;
_VerificationKey
=
sourceCompanyUser
.
_VerificationKey
;
_IsAccountVerified
=
sourceCompanyUser
.
_IsAccountVerified
;
_Email
=
sourceCompanyUser
.
_Email
;
_Password
=
sourceCompanyUser
.
_Password
;
_ConfirmPassword
=
sourceCompanyUser
.
_ConfirmPassword
;
...
...
@@ -1859,6 +1982,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
_VerificationMailSendDate
=
(
Date
)(
HELPER_VerificationMailSendDate
.
readExternal
(
_VerificationMailSendDate
,
vals
.
get
(
FIELD_VerificationMailSendDate
)));
//
_VerificationKey
=
(
String
)(
HELPER_VerificationKey
.
readExternal
(
_VerificationKey
,
vals
.
get
(
FIELD_VerificationKey
)));
//
_IsAccountVerified
=
(
Boolean
)(
HELPER_IsAccountVerified
.
readExternal
(
_IsAccountVerified
,
vals
.
get
(
FIELD_IsAccountVerified
)));
//
_Email
=
(
String
)(
HELPER_Email
.
readExternal
(
_Email
,
vals
.
get
(
FIELD_Email
)));
//
_Password
=
(
String
)(
HELPER_Password
.
readExternal
(
_Password
,
vals
.
get
(
FIELD_Password
)));
//
_ConfirmPassword
=
(
String
)(
HELPER_ConfirmPassword
.
readExternal
(
_ConfirmPassword
,
vals
.
get
(
FIELD_ConfirmPassword
)));
//
_Company
.
readExternalData
(
vals
.
get
(
SINGLEREFERENCE_Company
));
...
...
@@ -1880,6 +2004,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
vals
.
put
(
FIELD_VerificationMailSendDate
,
HELPER_VerificationMailSendDate
.
writeExternal
(
_VerificationMailSendDate
));
vals
.
put
(
FIELD_VerificationKey
,
HELPER_VerificationKey
.
writeExternal
(
_VerificationKey
));
vals
.
put
(
FIELD_IsAccountVerified
,
HELPER_IsAccountVerified
.
writeExternal
(
_IsAccountVerified
));
vals
.
put
(
FIELD_Email
,
HELPER_Email
.
writeExternal
(
_Email
));
vals
.
put
(
FIELD_Password
,
HELPER_Password
.
writeExternal
(
_Password
));
vals
.
put
(
FIELD_ConfirmPassword
,
HELPER_ConfirmPassword
.
writeExternal
(
_ConfirmPassword
));
vals
.
put
(
SINGLEREFERENCE_Company
,
_Company
.
writeExternalData
());
...
...
@@ -1939,6 +2064,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
super
.
visitAttributes
(
visitor
);
visitor
.
visitField
(
this
,
FIELD_Email
,
HELPER_Email
.
toObject
(
getEmail
()));
visitor
.
visitField
(
this
,
FIELD_Password
,
HELPER_Password
.
toObject
(
getPassword
()));
visitor
.
visitField
(
this
,
FIELD_ConfirmPassword
,
HELPER_ConfirmPassword
.
toObject
(
getConfirmPassword
()));
...
...
@@ -2403,6 +2529,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return
HELPER_IsAccountVerified
.
toObject
(
getIsAccountVerified
());
}
else
if
(
attribName
.
equals
(
FIELD_Email
))
{
return
HELPER_Email
.
toObject
(
getEmail
());
}
else
if
(
attribName
.
equals
(
FIELD_Password
))
{
return
HELPER_Password
.
toObject
(
getPassword
());
...
...
@@ -2452,6 +2582,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return
HELPER_IsAccountVerified
;
}
else
if
(
attribName
.
equals
(
FIELD_Email
))
{
return
HELPER_Email
;
}
else
if
(
attribName
.
equals
(
FIELD_Password
))
{
return
HELPER_Password
;
...
...
@@ -2501,6 +2635,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
setIsAccountVerified
((
Boolean
)(
HELPER_IsAccountVerified
.
fromObject
(
_IsAccountVerified
,
attribValue
)));
}
else
if
(
attribName
.
equals
(
FIELD_Email
))
{
setEmail
((
String
)(
HELPER_Email
.
fromObject
(
_Email
,
attribValue
)));
}
else
if
(
attribName
.
equals
(
FIELD_Password
))
{
setPassword
((
String
)(
HELPER_Password
.
fromObject
(
_Password
,
attribValue
)));
...
...
@@ -2561,6 +2699,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
{
return
getWriteability_Company
();
}
else
if
(
fieldName
.
equals
(
FIELD_Email
))
{
return
getWriteability_Email
();
}
else
if
(
fieldName
.
equals
(
FIELD_Password
))
{
return
getWriteability_Password
();
...
...
@@ -2614,6 +2756,11 @@ public abstract class BaseCompanyUser extends SecUserExtension
fields
.
add
(
FIELD_IsAccountVerified
);
}
if
(
getWriteability_Email
()
!=
FieldWriteability
.
TRUE
)
{
fields
.
add
(
FIELD_Email
);
}
if
(
getWriteability_Password
()
!=
FieldWriteability
.
TRUE
)
{
fields
.
add
(
FIELD_Password
);
...
...
@@ -2640,6 +2787,7 @@ public abstract class BaseCompanyUser extends SecUserExtension
result
.
add
(
HELPER_VerificationMailSendDate
.
getAttribObject
(
getClass
(),
_VerificationMailSendDate
,
false
,
FIELD_VerificationMailSendDate
));
result
.
add
(
HELPER_VerificationKey
.
getAttribObject
(
getClass
(),
_VerificationKey
,
false
,
FIELD_VerificationKey
));
result
.
add
(
HELPER_IsAccountVerified
.
getAttribObject
(
getClass
(),
_IsAccountVerified
,
false
,
FIELD_IsAccountVerified
));
result
.
add
(
HELPER_Email
.
getAttribObject
(
getClass
(),
_Email
,
false
,
FIELD_Email
));
result
.
add
(
HELPER_Password
.
getAttribObject
(
getClass
(),
_Password
,
false
,
FIELD_Password
));
result
.
add
(
HELPER_ConfirmPassword
.
getAttribObject
(
getClass
(),
_ConfirmPassword
,
false
,
FIELD_ConfirmPassword
));
...
...
@@ -2819,6 +2967,24 @@ public abstract class BaseCompanyUser extends SecUserExtension
}
/**
* Get the attribute Email
*/
public
String
getEmail
(
CompanyUser
obj
,
String
original
)
{
return
original
;
}
/**
* Change the value set for attribute Email.
* May modify the field beforehand
* Occurs before validation.
*/
public
String
setEmail
(
CompanyUser
obj
,
String
newEmail
)
throws
FieldException
{
return
newEmail
;
}
/**
* Get the attribute Password
*/
public
String
getPassword
(
CompanyUser
obj
,
String
original
)
...
...
@@ -2906,6 +3072,10 @@ public abstract class BaseCompanyUser extends SecUserExtension
public
PipeLine
<
From
,
?
extends
Object
>
to
(
String
name
)
{
if
(
name
.
equals
(
"Email"
))
{
return
toEmail
();
}
if
(
name
.
equals
(
"Password"
))
{
return
toPassword
();
...
...
@@ -2952,6 +3122,8 @@ public abstract class BaseCompanyUser extends SecUserExtension
}
public
PipeLine
<
From
,
String
>
toEmail
()
{
return
pipe
(
new
ORMAttributePipe
<
Me
,
String
>(
FIELD_Email
));
}
public
PipeLine
<
From
,
String
>
toPassword
()
{
return
pipe
(
new
ORMAttributePipe
<
Me
,
String
>(
FIELD_Password
));
}
public
PipeLine
<
From
,
String
>
toConfirmPassword
()
{
return
pipe
(
new
ORMAttributePipe
<
Me
,
String
>(
FIELD_ConfirmPassword
));
}
...
...
@@ -2981,6 +3153,11 @@ public abstract class BaseCompanyUser extends SecUserExtension
public
boolean
isTransientAttrib
(
String
attribName
)
{
if
(
CollectionUtils
.
equals
(
attribName
,
"Email"
))
{
return
true
;
}
if
(
CollectionUtils
.
equals
(
attribName
,
"Password"
))
{
return
true
;
...
...
cmsWebApp/src/performa/orm/CompanyUser.java
View file @
d5f156e0
...
...
@@ -87,4 +87,17 @@ public class CompanyUser extends BaseCompanyUser
return
super
.
getWriteability_Role
();
}
public
Boolean
emailExists
()
{
if
(
getEmail
()
!=
null
)
{
SecUser
user
=
SecUser
.
searchNAME
(
getTransaction
(),
getEmail
().
toLowerCase
());
return
user
!=
null
&&
user
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
)
!=
null
;
}
return
Boolean
.
FALSE
;
}
}
\ No newline at end of file
cmsWebApp/src/performa/orm/CompanyUser.xml
View file @
d5f156e0
...
...
@@ -7,6 +7,7 @@
<IMPORT
value=
"oneit.security.*"
/>
<IMPORT
value=
"performa.orm.types.*"
/>
<TRANSIENT
name=
"Email"
type=
"String"
validators=
"Email"
/>
<TRANSIENT
name=
"Password"
type=
"String"
/>
<TRANSIENT
name=
"ConfirmPassword"
type=
"String"
/>
...
...
cmsWebApp/webroot/css/common.css
View file @
d5f156e0
...
...
@@ -5517,3 +5517,8 @@ label, label .label-title span {
input
{
font-family
:
"Usual-Light"
;
}
.text-justify
{
font-family
:
"Usual-Light"
;
text-align
:
justify
;
}
\ No newline at end of file
cmsWebApp/webroot/extensions/adminportal/forgot_password.jsp
View file @
d5f156e0
...
...
@@ -10,22 +10,22 @@
<script type="text/javascript">
$(document).ready(function() {
recalcFunction = setupRecalc ($("form"), {'recalcOnError':true});
validate();
$('input[type="text"]').keyup(function() {
$(this).change();
validate();
$('input').on('change keyup', function() { validate() });
});
function validate() {
var empty = false;
$('input[required]').each(function() {
if ( $.trim($( this ).val()) == '') {
empty = true;
if ($( this ).css('background-color') == 'rgb(250, 255, 189)') {
empty = false;
}
}
$('#right-mark-div').onChange(function() {
alert($(this).attr('class'));
});
});
if (empty) {
function validate() {
if ($('#send-link-div')) {
$('.send-btn').attr('disabled', 'disabled');
} else {
$('.send-btn').removeAttr('disabled');
...
...
@@ -33,33 +33,59 @@
}
</script>
<style>
button[disabled]
{
.btn-disabled button
{
opacity: 0.6;
background-color: #0582ba;
}
</style>
<oneit:form name="forgotPassword" method="post">
#right-mark {
width: 24px;
height: 24px;
border-radius: 30px;
position: absolute;
top: 51%;
right: 37px;
background-color: #67b413;
padding-top: 5px;
}
#right-mark img {
width: 15px;
height: 15px;
display: block;
margin: auto auto;
}
</style>
<%
ORMProcessState process = (ORMProcessState) ProcessDecorator.getDefaultProcess(request);
ObjectTransaction objTran = process.getTransaction ();
CompanyUser companyUser = CompanyUser.createCompanyUser(objTran);
%>
<oneit:form name="forgotPassword" method="post" enctype="multipart/form-data">
<oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/>
<div class="main-box-layout login-box">
<div class="text-left
">
<p
>
<div class="text-justify
">
<p
>
Enter your email address below. If we find a matching account, then you'll receive an email with a password reset link.
</p>
</div>
<div> </div>
<div class="form-group text-left">
<label>Email Address</label>
<input type="email" class="form-control" name="email" required>
<oneit:ormInput obj="<%= companyUser %>" type="text" attributeName="Email" cssClass="form-control" autocomplete="off"/>
<oneit:recalcClass id="right-mark-div" htmlTag="div" classScript="companyUser.emailExists() ? 'show': 'hide'" companyUser="<%= companyUser %>" class="right-mark">
<span id="right-mark"><img src="../../images/right-mark.svg"/></span>
</oneit:recalcClass>
</div>
<div class="form-group">
<oneit:button value="Send" name="forgotPassword" cssClass="box-btn send-btn"
<oneit:recalcClass id="right-mark-div" htmlTag="div" classScript="companyUser.emailExists() ? 'show': 'btn-disabled'" companyUser="<%= companyUser %>" class="right-mark">
<oneit:button value="Send reset link" name="forgotPassword" cssClass="box-btn send-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", "sign_in.jsp?sent=true")
.mapEntry(NotificationUtils.NOTIFICATION_MSG_PARAM, "resetPasswordEmailSent")
.toMap() %>"/>
</oneit:recalcClass>
</div>
</div>
</oneit:form>
</oneit:form>
<%@ include file="inc/htmlfooter_nopriv.jsp" %>
\ No newline at end of file
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