Commit 71417f26 by chenith Committed by Harsh Shah

Added password reset option to admin portal.

parent 6f8284b6
<?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.DefineTableOperation">
<tableName factory="String">oneit_sec_user_extension</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="object_type" type="String" nullable="false" length="30"/>
<column name="forgot_password_mail_send_date" type="Date" nullable="true"/>
<column name="forgot_password_key" type="String" nullable="true" length="10"/>
<column name="user_id" type="Long" length="11" nullable="true"/>
</NODE>
<NODE name="INDEX" factory="Participant" class="oneit.sql.transfer.DefineIndexOperation" tableName="oneit_sec_user_extension" indexName="idx_oneit_sec_user_extension_user_id" isUnique="false"><column name="user_id"/></NODE>
</NODE></OBJECTS>
\ No newline at end of file
-- DROP TABLE oneit_sec_user_extension;
CREATE TABLE oneit_sec_user_extension (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
, object_type varchar(30) NOT NULL ,
forgot_password_mail_send_date datetime NULL,
forgot_password_key varchar(10) NULL,
user_id numeric(12) NULL
);
ALTER TABLE oneit_sec_user_extension ADD
CONSTRAINT PK_oneit_sec_user_extension PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_oneit_sec_user_extension_user_id
ON oneit_sec_user_extension (user_id);
-- DROP TABLE oneit_sec_user_extension;
CREATE TABLE oneit_sec_user_extension (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
, object_type varchar2(30) NOT NULL ,
forgot_password_mail_send_date date NULL,
forgot_password_key varchar2(10) NULL,
user_id number(12) NULL
);
ALTER TABLE oneit_sec_user_extension ADD
CONSTRAINT PK_oneit_sec_user_extension PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_oneit_sec_user_extension_user_id
ON oneit_sec_user_extension (user_id);
-- @AutoRun
-- drop table oneit_sec_user_extension;
CREATE TABLE oneit_sec_user_extension (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
, object_type varchar(30) NOT NULL ,
forgot_password_mail_send_date timestamp NULL,
forgot_password_key varchar(10) NULL,
user_id numeric(12) NULL
);
ALTER TABLE oneit_sec_user_extension ADD
CONSTRAINT pk_oneit_sec_user_extension PRIMARY KEY
(
object_id
) ;
CREATE INDEX idx_oneit_sec_user_extension_user_id
ON oneit_sec_user_extension (user_id);
package performa.form;
import java.util.Date;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import oneit.components.ParticipantInitialisationContext;
import oneit.email.ConfigurableEmailer;
import oneit.logging.*;
import oneit.net.LoopbackHTTP;
import oneit.objstore.ObjectTransaction;
import oneit.objstore.StorageException;
import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.security.SecUser;
import oneit.security.SecUserExtension;
import oneit.servlets.forms.*;
import oneit.servlets.process.*;
import oneit.utils.*;
import oneit.utils.transform.MapTransform;
import oneit.utils.transform.param.ErrorTransform;
import oneit.utils.transform.param.ORMTransform;
import oneit.utils.transform.param.PrefixCompoundTransform;
import performa.orm.AdminUser;
public class ForgotPasswordFP extends SaveFP
{
private static LoggingArea LOG = LoggingArea.createLoggingArea("ForgotPasswordFP");
protected int DEFAULT_PASSWORD_LENGTH = 6;
protected ConfigurableEmailer resetCodeEmailer;
@Override
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
{
HttpServletRequest request = submission.getRequest();
ObjectTransaction objTran = process.getTransaction();
String email = (String) request.getParameter("email");
Debug.assertion(email != null, "Email not avaialble");
LogMgr.log(LOG, LogLevel.PROCESSING1, "Started to send pasword reset link email.", email);
SecUser secUser = SecUser.searchNAME (process.getTransaction(), email);
if(secUser==null)
{
SecUser[] userSearch = SecUser.SearchByALL().andEmail(new EqualsFilter<>(email)).search(objTran);
if(userSearch.length>0)
{
secUser = userSearch[0];
}
}
if(secUser!=null)
{
LogMgr.log(LOG, LogLevel.PROCESSING1, "Inside ForgotPasswordFP for send reset pasword link mail to ", email);
AdminUser adminUser = secUser.getExtensionOrCreate(AdminUser.REFERENCE_AdminUser);
if(adminUser.getForgotPasswordKey()==null)
{
String resetCode = new RandomStringGen().generateHumanAlphaNum(new Integer(DEFAULT_PASSWORD_LENGTH));
adminUser.setForgotPasswordKey(resetCode);
}
adminUser.setForgotPasswordMailSendDate(new Date());
Map emailParams = CollectionUtils.mapEntry("resetcode", adminUser.getForgotPasswordKey())
.mapEntry("url", LoopbackHTTP.getRemoteAccessURL()
+ "/extensions/adminportal/reset_password.jsp"
+ "?id=" + adminUser.getID()
+ "&key=" + adminUser.getForgotPasswordKey()).toMap();
PrefixCompoundTransform compoundTransform = new PrefixCompoundTransform();
ObjectTransform defaultTransform = new MapTransform(emailParams);
compoundTransform.setDefault(defaultTransform);
compoundTransform.add("user", new ORMTransform(secUser));
ObjectTransform transform = new StringUtils.NullToBlankPostTransform(new ErrorTransform(compoundTransform));
try
{
resetCodeEmailer.sendMail(transform, new String[] { email });
LogMgr.log(LOG, LogLevel.PROCESSING1, "Mail has been sent from " + ForgotPasswordFP.class + " to :: ", email);
}
catch(Exception e)
{
LogMgr.log(LoggingArea.ALL, LogLevel.PROCESSING1, e, "Error while sending email");
throw new BusinessException("Mail can not be sent. Please contact administrator.");
}
}
else
{
throw new BusinessException("Sorry, we don't recognize that email address.");
}
return super.processForm(process, submission, params);
}
public void init(ParticipantInitialisationContext context) throws InitialisationException
{
super.init(context);
resetCodeEmailer = (ConfigurableEmailer)(context.getSingleChild("ResetCodeEmailer"));
}
}
\ No newline at end of file
package performa.form;
import java.util.Map;
import oneit.logging.*;
import oneit.objstore.StorageException;
import oneit.objstore.parser.BusinessObjectParser;
import oneit.security.SecUser;
import oneit.servlets.forms.*;
import oneit.servlets.process.*;
import oneit.utils.*;
import performa.orm.AdminUser;
import performa.utils.Utils;
public class ResetPasswordFP extends ORMProcessFormProcessor
{
private static LoggingArea LOG = LoggingArea.createLoggingArea("ResetPasswordFP");
@Override
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
{
SecUser user = (SecUser) process.getAttribute("SecUser");
AdminUser adminUser = user.getExtension(AdminUser.REFERENCE_AdminUser);
if(adminUser != null)
{
LogMgr.log(LOG, LogLevel.PROCESSING1, "Inside ResetPasswordFP for reset pasword to ", user);
adminUser.setForgotPasswordKey(null);
}
return Utils.processSuccessfulLogin(process, submission, params, user);
}
@Override
public void validate(ORMProcessState process, SubmissionDetails submission, MultiException exceptions, Map params) throws StorageException
{
super.validate(process, submission, exceptions, params);
SecUser user = (SecUser) process.getAttribute("SecUser");
Debug.assertion(user != null, "No user found for rest password. Call from " + getClass().getName());
BusinessObjectParser.assertFieldCondition(user.getPassword().length() >= 8, user, SecUser.FIELD_Password, exceptions, true, submission.getRequest());
}
}
\ No newline at end of file
package performa.orm;
import oneit.objstore.ObjectTransaction;
import oneit.security.SecUser;
import oneit.utils.CollectionUtils;
import oneit.utils.StringUtils;
public class AdminUser extends BaseAdminUser
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public AdminUser ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
public static AdminUser getAdminUserForForgotPassword(ObjectTransaction transaction, String userIDStr, String code)
{
userIDStr = StringUtils.subBlanks(userIDStr);
code = StringUtils.subBlanks(code);
if(userIDStr != null && code!=null)
{
AdminUser adminUser = AdminUser.getAdminUserByID(transaction, Long.parseLong(userIDStr));
if(adminUser != null && CollectionUtils.equals(adminUser.getForgotPasswordKey(), code))
{
return adminUser;
}
}
return null;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>
<BUSINESSCLASS name="AdminUser" package="performa.orm" superclass="SecUserExtension">
<IMPORT value="oneit.security.*" />
<TABLE name="oneit_sec_user_extension" tablePrefix="object" polymorphic="TRUE">
<ATTRIB name="ForgotPasswordMailSendDate" type="Date" dbcol="forgot_password_mail_send_date" />
<ATTRIB name="ForgotPasswordKey" type="String" dbcol="forgot_password_key" length="10"/>
<SINGLEREFERENCE name="User" type="SecUser" dbcol="user_id" backreferenceName="Extensions" inSuper='TRUE'/>
</TABLE>
<SEARCH type="All" paramFilter="oneit_sec_user_extension.object_id is not null" >
</SEARCH>
<SEARCH type="IdPin" paramFilter="oneit_sec_user_extension.object_id is not null" singleton="TRUE">
<PARAM name="ID" type="Long" paramFilter="object_id = ${ID} " />
<PARAM name="Pin" type="String" paramFilter="verification_key = ${Pin}" />
</SEARCH>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm;
import java.io.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.rdbms.*;
import oneit.objstore.utils.*;
import oneit.sql.*;
import oneit.utils.resource.*;
import oneit.utils.*;
import oneit.utils.threading.*;
import oneit.security.*;
/**
* IMPORTANT!!!! Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2[oneit.objstore.PersistenceMgrTemplate.xsl]
*/
public class AdminUserPersistenceMgr extends SecUserExtensionPersistenceMgr
{
private static final LoggingArea AdminUserPersistence = LoggingArea.createLoggingArea(ObjectPersistenceMgr.OBJECT_PERSISTENCE, "AdminUser");
// Private attributes corresponding to business object data
private Date dummyForgotPasswordMailSendDate;
private String dummyForgotPasswordKey;
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper HELPER_ForgotPasswordMailSendDate = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_ForgotPasswordKey = DefaultAttributeHelper.INSTANCE;
public AdminUserPersistenceMgr ()
{
dummyForgotPasswordMailSendDate = (Date)(HELPER_ForgotPasswordMailSendDate.initialise (dummyForgotPasswordMailSendDate));
dummyForgotPasswordKey = (String)(HELPER_ForgotPasswordKey.initialise (dummyForgotPasswordKey));
}
private String SELECT_COLUMNS = "{PREFIX}oneit_sec_user_extension.object_id as id, {PREFIX}oneit_sec_user_extension.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}oneit_sec_user_extension.object_CREATED_DATE as CREATED_DATE, {PREFIX}oneit_sec_user_extension.object_TYPE as OBJECT_TYPE, {PREFIX}oneit_sec_user_extension.forgot_password_mail_send_date, {PREFIX}oneit_sec_user_extension.forgot_password_key, {PREFIX}oneit_sec_user_extension.user_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> resultByIDs = fetchByIDs(Collections.singleton (id), allPSets, context, sqlMgr);
if (resultByIDs.isEmpty ())
{
return null;
}
else if (resultByIDs.size () > 1)
{
throw new StorageException ("Multiple results for id:" + id);
}
else
{
return resultByIDs.iterator ().next ();
}
}
public Set<BaseBusinessClass> fetchByIDs(Set<ObjectID> ids, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
Set<BaseBusinessClass> results = new HashSet ();
Set<Long> idsToFetch = new HashSet ();
for (ObjectID id : ids)
{
if (context.containsObject(id)) // Check for cached version
{
BaseBusinessClass objectToReturn = context.getObjectToReplace(id, AdminUser.REFERENCE_AdminUser);
if (objectToReturn instanceof AdminUser)
{
LogMgr.log (AdminUserPersistence, LogLevel.TRACE, "Cache hit for id:", id);
results.add (objectToReturn);
}
else
{
throw new StorageException ("Cache collision for id:" + id + " with object " + objectToReturn + "while fetching a AdminUser");
}
}
PersistentSet oneit_sec_user_extensionPSet = allPSets.getPersistentSet(id, "oneit_sec_user_extension", PersistentSetStatus.FETCHED);
String objectType = null;
// Check for persistent sets already prefetched
if (false ||
!oneit_sec_user_extensionPSet.containsAttrib("OBJECT_TYPE") || !oneit_sec_user_extensionPSet.containsAttrib(BaseBusinessClass.FIELD_ObjectLastModified) ||
!oneit_sec_user_extensionPSet.containsAttrib(AdminUser.FIELD_ForgotPasswordMailSendDate)||
!oneit_sec_user_extensionPSet.containsAttrib(AdminUser.FIELD_ForgotPasswordKey)||
!oneit_sec_user_extensionPSet.containsAttrib(AdminUser.SINGLEREFERENCE_User))
{
// We will need to retrieve it
idsToFetch.add (id.longValue());
}
else
{
LogMgr.log (AdminUserPersistence, LogLevel.DEBUG2, "Persistent set preloaded id:", id);
/* Polymorphic */
objectType = (String)(oneit_sec_user_extensionPSet.getAttrib("OBJECT_TYPE"));
if (context.getReferenceObject (AdminUser.REFERENCE_AdminUser, objectType) != AdminUser.REFERENCE_AdminUser)
{
idsToFetch.add (id.longValue());
}
else
{
AdminUser result = new AdminUser ();
result.setFromPersistentSets(id, allPSets);
context.addRetrievedObject(result);
results.add (result);
}
}
}
if (idsToFetch.size () > 0)
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}oneit_sec_user_extension " +
"WHERE " + SELECT_JOINS + "{PREFIX}oneit_sec_user_extension.object_id IN ?";
BaseBusinessClass[] resultsFetched = loadQuery (allPSets, sqlMgr, context, query, new Object[] { idsToFetch }, null, false);
for (BaseBusinessClass objFetched : resultsFetched)
{
results.add (objFetched);
}
}
return results;
}
public BaseBusinessClass[] getReferencedObjects(ObjectID _objectID, String refName, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
if (false)
{
throw new RuntimeException ();
}
else if (refName.equals (AdminUser.SINGLEREFERENCE_User))
{
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}oneit_sec_user_extension " +
"WHERE " + SELECT_JOINS + "user_id = ?";
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, new Object[] { _objectID.longID () }, null, false);
return results;
}
else
{
throw new IllegalArgumentException ("Illegal reference type:" + refName);
}
}
public void update(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
EqualityResult test = EqualityResult.compare (obj, obj.getBackup ());
ObjectID objectID = obj.getID ();
if (!test.areAttributesEqual () || !test.areSingleAssocsEqual () || obj.getForcedSave())
{
PersistentSet oneit_sec_user_extensionPSet = allPSets.getPersistentSet(objectID, "oneit_sec_user_extension");
if (oneit_sec_user_extensionPSet.getStatus () != PersistentSetStatus.PROCESSED &&
oneit_sec_user_extensionPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}oneit_sec_user_extension " +
"SET forgot_password_mail_send_date = ?, forgot_password_key = ?, user_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE oneit_sec_user_extension.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_ForgotPasswordMailSendDate.getForSQL(dummyForgotPasswordMailSendDate, oneit_sec_user_extensionPSet.getAttrib (AdminUser.FIELD_ForgotPasswordMailSendDate))).listEntry (HELPER_ForgotPasswordKey.getForSQL(dummyForgotPasswordKey, oneit_sec_user_extensionPSet.getAttrib (AdminUser.FIELD_ForgotPasswordKey))).listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (AdminUser.SINGLEREFERENCE_User)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id, object_LAST_UPDATED_DATE FROM {PREFIX}oneit_sec_user_extension WHERE object_id = ?",
new Object[] { objectID.longID () });
if (r.next ())
{
Date d = new java.util.Date (r.getTimestamp (2).getTime());
String errorMsg = QueryBuilder.buildQueryString ("Concurrent update error:[?] for row:[?] objDate:[?] dbDate:[?]",
new Object[] { "oneit_sec_user_extension", objectID.longID (), obj.getObjectLastModified (), d },
sqlMgr.getPortabilityServices ());
LogMgr.log (AdminUserPersistence, LogLevel.BUSINESS1, errorMsg);
throw new ConcurrentUpdateConflictException (obj, "oneit_sec_user_extension");
}
else
{
String errorMsg = "Attempt to update nonexistent row in table:oneit_sec_user_extension for row:" + objectID + " objDate:" + obj.getObjectLastModified ();
LogMgr.log (AdminUserPersistence, LogLevel.BUSINESS1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
oneit_sec_user_extensionPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
else
{
LogMgr.log (AdminUserPersistence, LogLevel.DEBUG1, "Skipping update since no attribs or simple assocs changed on ", objectID);
}
}
public void delete(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, ConcurrentUpdateConflictException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet oneit_sec_user_extensionPSet = allPSets.getPersistentSet(objectID, "oneit_sec_user_extension");
LogMgr.log (AdminUserPersistence, LogLevel.DEBUG2, "Deleting:", objectID);
if (oneit_sec_user_extensionPSet.getStatus () != PersistentSetStatus.PROCESSED &&
oneit_sec_user_extensionPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
int rowsDeleted = executeStatement (sqlMgr,
"DELETE " +
"FROM {PREFIX}oneit_sec_user_extension " +
"WHERE oneit_sec_user_extension.object_id = ? AND " + sqlMgr.getPortabilityServices ().getTruncatedTimestampColumn ("object_LAST_UPDATED_DATE") + " = " + sqlMgr.getPortabilityServices ().getTruncatedTimestampParam("?") + " ",
new Object[] { objectID.longID(), obj.getObjectLastModified () });
if (rowsDeleted != 1)
{
// Error, either a concurrency error or a not-exists error
ResultSet r = executeQuery (sqlMgr,
"SELECT object_id FROM {PREFIX}oneit_sec_user_extension WHERE object_id = ?",
new Object[] { objectID.longID() });
if (r.next ())
{
throw new ConcurrentUpdateConflictException (obj, "oneit_sec_user_extension");
}
else
{
String errorMsg = "Attempt to delete nonexistent row in table:oneit_sec_user_extension for row:" + objectID;
LogMgr.log (AdminUserPersistence, LogLevel.SYSTEMERROR1, errorMsg);
throw new RuntimeException (errorMsg);
}
}
oneit_sec_user_extensionPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
public ResultSet executeSearchQueryAll (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public ResultSet executeSearchQueryIdPin (SQLManager sqlMgr, Long ID, String Pin) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryIdPin");
}
public BaseBusinessClass[] loadQuery (PersistentSetCollection allPSets, SQLManager sqlMgr, RDBMSPersistenceContext context, String query, Object[] params, Integer maxRows, boolean truncateExtra) throws SQLException, StorageException
{
LinkedHashMap<ObjectID, AdminUser> results = new LinkedHashMap ();
MultiHashtable<String,ObjectID> needsRefetch = new MultiHashtable ();
ResultSet r = executeQuery (sqlMgr, query, params);
while (r.next())
{
ThreadUtils.checkInterrupted ();
ObjectID objectID = new ObjectID (AdminUser.REFERENCE_AdminUser.getObjectIDSpace (), r.getLong ("id"));
AdminUser resultElement;
if (maxRows != null && !results.containsKey (objectID) && results.size () >= maxRows)
{
if (truncateExtra)
{
break;
}
else
{
throw new SearchRowsExceededException ("Maximum rows exceeded:" + maxRows);
}
}
if (context.containsObject(objectID))
{
BaseBusinessClass cachedElement = context.getObjectToReplace(objectID, AdminUser.REFERENCE_AdminUser);
if (cachedElement instanceof AdminUser)
{
LogMgr.log (AdminUserPersistence, LogLevel.TRACE, "Cache hit for id:", objectID);
resultElement = (AdminUser)cachedElement;
}
else
{
throw new StorageException ("Cache collision for id:" + objectID + " with object " + cachedElement + "while fetching a AdminUser");
}
}
else
{
PersistentSet oneit_sec_user_extensionPSet = allPSets.getPersistentSet(objectID, "oneit_sec_user_extension", PersistentSetStatus.FETCHED);
createPersistentSetFromRS(allPSets, r, objectID);
String objectType = (String)(oneit_sec_user_extensionPSet.getAttrib("OBJECT_TYPE"));
if (context.getReferenceObject (AdminUser.REFERENCE_AdminUser, objectType) != AdminUser.REFERENCE_AdminUser)
{
needsRefetch.add (objectType, objectID); // We will fetch these later
resultElement = new AdminUser ();
resultElement.initialiseGhost (objectID);
}
else
{
resultElement = new AdminUser ();
resultElement.setFromPersistentSets(objectID, allPSets);
context.addRetrievedObject(resultElement);
}
}
results.put (objectID, resultElement);
}
for (String objectType : needsRefetch.keySet())
{
BaseBusinessClass referenceObject = context.getReferenceObject (AdminUser.REFERENCE_AdminUser, objectType);
ObjectPersistenceMgr persistenceMgr = context.getPersistenceMgr (referenceObject);
ResourceCheckpoint checkpoint = sqlMgr.getCheckpoint();
Set<BaseBusinessClass> objsRefetched = persistenceMgr.fetchByIDs(new HashSet (needsRefetch.getValuesForKey (objectType)), allPSets, context, sqlMgr);
checkpoint.releaseNewResources();
for (BaseBusinessClass objRefetched : objsRefetched)
{
results.put (objRefetched.getID (), (AdminUser)objRefetched);
}
}
BaseBusinessClass[] resultsArr = new BaseBusinessClass[results.size ()];
return results.values ().toArray (resultsArr);
}
public BaseBusinessClass[] find(String searchType, PersistentSetCollection allPSets, Hashtable criteria, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
LogMgr.log (AdminUserPersistence, LogLevel.DEBUG2, "Search executing:", searchType, " criteria:", criteria);
String customParamFilter = (String)criteria.get (SEARCH_CustomFilter);
String customOrderBy = (String)criteria.get (SEARCH_OrderBy);
String customTables = (String)criteria.get (SEARCH_CustomExtraTables);
Boolean noCommaBeforeCustomExtraTables = (Boolean)criteria.get (SEARCH_CustomExtraTablesNoComma);
if (searchType.equals (SEARCH_CustomSQL))
{
Set<ObjectID> processedIDs = new HashSet();
SearchParamTransform tx = new SearchParamTransform (criteria);
Object[] searchParams;
customParamFilter = StringUtils.replaceParams (customParamFilter, tx);
searchParams = tx.getParamsArray();
if (customOrderBy != null)
{
customOrderBy = " ORDER BY " + customOrderBy;
}
else
{
customOrderBy = "";
}
ResultSet r;
String concatCustomTableWith = CollectionUtils.equals(noCommaBeforeCustomExtraTables, true) ? " " : ", ";
String tables = StringUtils.subBlanks(customTables) == null ? " " : concatCustomTableWith + customTables + " ";
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}oneit_sec_user_extension " + tables +
"WHERE " + SELECT_JOINS + " " + customParamFilter + customOrderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, null, false);
return results;
}
else if (searchType.equals (AdminUser.SEARCH_All))
{
// Local scope for transformed variables
{
}
String orderBy = " ";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: oneit_sec_user_extension.object_id is not null
String preFilter = "(oneit_sec_user_extension.object_id is not null)"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}oneit_sec_user_extension " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else if (searchType.equals (AdminUser.SEARCH_IdPin))
{
// Local scope for transformed variables
{
}
String orderBy = " ";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: oneit_sec_user_extension.object_id is not null
String preFilter = "(oneit_sec_user_extension.object_id is not null)"
+ " ";
if (criteria.containsKey("ID"))
{
preFilter += " AND (object_id = ${ID} ) ";
preFilter += "";
}
if (criteria.containsKey("Pin"))
{
preFilter += " AND (verification_key = ${Pin}) ";
preFilter += "";
}
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}oneit_sec_user_extension " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
BaseBusinessClass[] resultsArray = super.find(searchType, allPSets, criteria, context, sqlMgr);
Vector results = new Vector ();
for (int x = 0 ; x < resultsArray.length ; ++x)
{
if (resultsArray[x] instanceof AdminUser)
{
results.add (resultsArray[x]);
}
else
{
// Ignore
}
}
resultsArray = new BaseBusinessClass[results.size ()];
results.copyInto (resultsArray);
return resultsArray;
}
}
private void createPersistentSetFromRS(PersistentSetCollection allPSets, ResultSet r, ObjectID objectID) throws SQLException
{
PersistentSet oneit_sec_user_extensionPSet = allPSets.getPersistentSet(objectID, "oneit_sec_user_extension", PersistentSetStatus.FETCHED);
// Object Modified
oneit_sec_user_extensionPSet.setAttrib(BaseBusinessClass.FIELD_ObjectLastModified, r.getTimestamp ("LAST_UPDATED_DATE"));
// Object Created
oneit_sec_user_extensionPSet.setAttrib(BaseBusinessClass.FIELD_ObjectCreated, r.getTimestamp ("CREATED_DATE"));oneit_sec_user_extensionPSet.setAttrib("OBJECT_TYPE", r.getString ("OBJECT_TYPE"));
oneit_sec_user_extensionPSet.setAttrib(AdminUser.FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.getFromRS(dummyForgotPasswordMailSendDate, r, "forgot_password_mail_send_date"));
oneit_sec_user_extensionPSet.setAttrib(AdminUser.FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.getFromRS(dummyForgotPasswordKey, r, "forgot_password_key"));
oneit_sec_user_extensionPSet.setAttrib(AdminUser.SINGLEREFERENCE_User, r.getObject ("user_id"));
}
public void create(BaseBusinessClass obj, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
{
ObjectID objectID = obj.getID ();
PersistentSet oneit_sec_user_extensionPSet = allPSets.getPersistentSet(objectID, "oneit_sec_user_extension");
if (oneit_sec_user_extensionPSet.getStatus () != PersistentSetStatus.PROCESSED &&
oneit_sec_user_extensionPSet.getStatus () != PersistentSetStatus.DEFERRED)
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}oneit_sec_user_extension " +
" (forgot_password_mail_send_date, forgot_password_key, user_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE, object_TYPE) " +
"VALUES " +
" (?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", ?)",
CollectionUtils.listEntry (HELPER_ForgotPasswordMailSendDate.getForSQL(dummyForgotPasswordMailSendDate, oneit_sec_user_extensionPSet.getAttrib (AdminUser.FIELD_ForgotPasswordMailSendDate))).listEntry (HELPER_ForgotPasswordKey.getForSQL(dummyForgotPasswordKey, oneit_sec_user_extensionPSet.getAttrib (AdminUser.FIELD_ForgotPasswordKey))) .listEntry (SQLManager.CheckNull((Long)(oneit_sec_user_extensionPSet.getAttrib (AdminUser.SINGLEREFERENCE_User)))) .listEntry (objectID.longID ()).listEntry (context.getTag (obj)).toList().toArray());
oneit_sec_user_extensionPSet.setStatus (PersistentSetStatus.PROCESSED);
}
}
}
/*
* IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
* Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
*
* Version: 1.0
* Vendor: Apache Software Foundation (Xalan XSLTC)
* Vendor URL: http://xml.apache.org/xalan-j
*/
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;
import oneit.security.*;
public abstract class BaseAdminUser extends SecUserExtension
{
// Reference instance for the object
public static final AdminUser REFERENCE_AdminUser = new AdminUser ();
// Reference instance for the object
public static final AdminUser DUMMY_AdminUser = new DummyAdminUser ();
// Static constants corresponding to field names
public static final String FIELD_ForgotPasswordMailSendDate = "ForgotPasswordMailSendDate";
public static final String FIELD_ForgotPasswordKey = "ForgotPasswordKey";
// Static constants corresponding to searches
public static final String SEARCH_All = "All";
public static final String SEARCH_IdPin = "IdPin";
// Static constants corresponding to attribute helpers
private static final DefaultAttributeHelper<AdminUser> HELPER_ForgotPasswordMailSendDate = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<AdminUser> HELPER_ForgotPasswordKey = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
private Date _ForgotPasswordMailSendDate;
private String _ForgotPasswordKey;
// Private attributes corresponding to single references
// Private attributes corresponding to multiple references
// Map of maps of metadata
private static final Map ATTRIBUTES_METADATA_AdminUser = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_ForgotPasswordMailSendDate_Validators;
private static final AttributeValidator[] FIELD_ForgotPasswordKey_Validators;
// Arrays of behaviour decorators
private static final AdminUserBehaviourDecorator[] AdminUser_BehaviourDecorators;
static
{
try
{
Map validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));
FIELD_ForgotPasswordMailSendDate_Validators = (AttributeValidator[])setupAttribMetaData_ForgotPasswordMailSendDate(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_ForgotPasswordKey_Validators = (AttributeValidator[])setupAttribMetaData_ForgotPasswordKey(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_AdminUser.initialiseReference ();
DUMMY_AdminUser.initialiseReference ();
AdminUser_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(AdminUser.class).toArray(new AdminUserBehaviourDecorator[0]);
}
catch (RuntimeException e)
{
LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
throw e;
}
}
// Meta Info setup
private static List setupAttribMetaData_ForgotPasswordMailSendDate(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "forgot_password_mail_send_date");
metaInfo.put ("name", "ForgotPasswordMailSendDate");
metaInfo.put ("type", "Date");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AdminUser.ForgotPasswordMailSendDate:", metaInfo);
ATTRIBUTES_METADATA_AdminUser.put (FIELD_ForgotPasswordMailSendDate, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(AdminUser.class, "ForgotPasswordMailSendDate", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for AdminUser.ForgotPasswordMailSendDate:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_ForgotPasswordKey(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "forgot_password_key");
metaInfo.put ("length", "10");
metaInfo.put ("name", "ForgotPasswordKey");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AdminUser.ForgotPasswordKey:", metaInfo);
ATTRIBUTES_METADATA_AdminUser.put (FIELD_ForgotPasswordKey, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(AdminUser.class, "ForgotPasswordKey", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for AdminUser.ForgotPasswordKey:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
// This constructor should not be called
protected BaseAdminUser ()
{
}
protected BBCBehaviourDecorator[] getBehaviours()
{
return AdminUser_BehaviourDecorators;
}
// Initialise the attributes
protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
{
super._initialiseNewObjAttributes (transaction);
_ForgotPasswordMailSendDate = (Date)(HELPER_ForgotPasswordMailSendDate.initialise (_ForgotPasswordMailSendDate));
_ForgotPasswordKey = (String)(HELPER_ForgotPasswordKey.initialise (_ForgotPasswordKey));
}
// Initialise the associations
protected void _initialiseAssociations ()
{
super._initialiseAssociations ();
}
// Initialise the associations
protected BaseBusinessClass initialiseReference ()
{
super.initialiseReference ();
return this;
}
/**
* Get the attribute ForgotPasswordMailSendDate
*/
public Date getForgotPasswordMailSendDate ()
{
assertValid();
Date valToReturn = _ForgotPasswordMailSendDate;
for (AdminUserBehaviourDecorator bhd : AdminUser_BehaviourDecorators)
{
valToReturn = bhd.getForgotPasswordMailSendDate ((AdminUser)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 preForgotPasswordMailSendDateChange (Date newForgotPasswordMailSendDate) 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 postForgotPasswordMailSendDateChange () throws FieldException
{
}
public FieldWriteability getWriteability_ForgotPasswordMailSendDate ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute ForgotPasswordMailSendDate. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setForgotPasswordMailSendDate (Date newForgotPasswordMailSendDate) throws FieldException
{
boolean oldAndNewIdentical = HELPER_ForgotPasswordMailSendDate.compare (_ForgotPasswordMailSendDate, newForgotPasswordMailSendDate);
try
{
for (AdminUserBehaviourDecorator bhd : AdminUser_BehaviourDecorators)
{
newForgotPasswordMailSendDate = bhd.setForgotPasswordMailSendDate ((AdminUser)this, newForgotPasswordMailSendDate);
oldAndNewIdentical = HELPER_ForgotPasswordMailSendDate.compare (_ForgotPasswordMailSendDate, newForgotPasswordMailSendDate);
}
if (FIELD_ForgotPasswordMailSendDate_Validators.length > 0)
{
Object newForgotPasswordMailSendDateObj = HELPER_ForgotPasswordMailSendDate.toObject (newForgotPasswordMailSendDate);
if (newForgotPasswordMailSendDateObj != null)
{
int loopMax = FIELD_ForgotPasswordMailSendDate_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_AdminUser.get (FIELD_ForgotPasswordMailSendDate);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_ForgotPasswordMailSendDate_Validators[v].checkAttribute (this, FIELD_ForgotPasswordMailSendDate, metadata, newForgotPasswordMailSendDateObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_ForgotPasswordMailSendDate () != FieldWriteability.FALSE, "Field ForgotPasswordMailSendDate is not writeable");
preForgotPasswordMailSendDateChange (newForgotPasswordMailSendDate);
markFieldChange (FIELD_ForgotPasswordMailSendDate);
_ForgotPasswordMailSendDate = newForgotPasswordMailSendDate;
postFieldChange (FIELD_ForgotPasswordMailSendDate);
postForgotPasswordMailSendDateChange ();
}
}
/**
* Get the attribute ForgotPasswordKey
*/
public String getForgotPasswordKey ()
{
assertValid();
String valToReturn = _ForgotPasswordKey;
for (AdminUserBehaviourDecorator bhd : AdminUser_BehaviourDecorators)
{
valToReturn = bhd.getForgotPasswordKey ((AdminUser)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 preForgotPasswordKeyChange (String newForgotPasswordKey) 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 postForgotPasswordKeyChange () throws FieldException
{
}
public FieldWriteability getWriteability_ForgotPasswordKey ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute ForgotPasswordKey. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setForgotPasswordKey (String newForgotPasswordKey) throws FieldException
{
boolean oldAndNewIdentical = HELPER_ForgotPasswordKey.compare (_ForgotPasswordKey, newForgotPasswordKey);
try
{
for (AdminUserBehaviourDecorator bhd : AdminUser_BehaviourDecorators)
{
newForgotPasswordKey = bhd.setForgotPasswordKey ((AdminUser)this, newForgotPasswordKey);
oldAndNewIdentical = HELPER_ForgotPasswordKey.compare (_ForgotPasswordKey, newForgotPasswordKey);
}
if (FIELD_ForgotPasswordKey_Validators.length > 0)
{
Object newForgotPasswordKeyObj = HELPER_ForgotPasswordKey.toObject (newForgotPasswordKey);
if (newForgotPasswordKeyObj != null)
{
int loopMax = FIELD_ForgotPasswordKey_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_AdminUser.get (FIELD_ForgotPasswordKey);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_ForgotPasswordKey_Validators[v].checkAttribute (this, FIELD_ForgotPasswordKey, metadata, newForgotPasswordKeyObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_ForgotPasswordKey () != FieldWriteability.FALSE, "Field ForgotPasswordKey is not writeable");
preForgotPasswordKeyChange (newForgotPasswordKey);
markFieldChange (FIELD_ForgotPasswordKey);
_ForgotPasswordKey = newForgotPasswordKey;
postFieldChange (FIELD_ForgotPasswordKey);
postForgotPasswordKeyChange ();
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getSingleAssocs()
{
List result = super.getSingleAssocs ();
return result;
}
public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssocReferenceInstance (assocName);
}
}
public String getSingleAssocBackReference(String assocName)
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssocBackReference (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssoc (assocName);
}
}
public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssoc (assocName, getType);
}
}
public Long getSingleAssocID (String assocName) throws StorageException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
return super.getSingleAssocID (assocName);
}
}
public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
{
if (assocName == null)
{
throw new RuntimeException ("Game over == null!");
}
else
{
super.setSingleAssoc (assocName, newValue);
}
}
/**
* A list of multi assoc names e.g. list of strings.
*/
public List<String> getMultiAssocs()
{
List result = super.getMultiAssocs ();
return result;
}
/**
* Get the reference instance for the multi assoc name.
*/
public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
{
return super.getMultiAssocReferenceInstance(attribName);
}
public String getMultiAssocBackReference(String attribName)
{
return super.getMultiAssocBackReference(attribName);
}
/**
* Get the assoc count for the multi assoc name.
*/
public int getMultiAssocCount(String attribName) throws StorageException
{
return super.getMultiAssocCount(attribName);
}
/**
* Get the assoc at a particular index
*/
public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
{
return super.getMultiAssocAt(attribName, index);
}
/**
* Add to a multi assoc by attribute name
*/
public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
{
super.addToMultiAssoc(attribName, newElement);
}
/**
* Remove from a multi assoc by attribute name
*/
public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
{
super.removeFromMultiAssoc(attribName, oldElement);
}
protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
{
super.__loadMultiAssoc(attribName, elements);
}
protected boolean __isMultiAssocLoaded (String attribName)
{
return super.__isMultiAssocLoaded(attribName);
}
public void onDelete ()
{
try
{
}
catch (Exception e)
{
throw NestedException.wrap(e);
}
super.onDelete ();
}
public AdminUser newInstance ()
{
return new AdminUser ();
}
public AdminUser referenceInstance ()
{
return REFERENCE_AdminUser;
}
public AdminUser getInTransaction (ObjectTransaction t) throws StorageException
{
return getAdminUserByID (t, getObjectID());
}
public BaseBusinessClass dummyInstance ()
{
return DUMMY_AdminUser;
}
public String getBaseSetName ()
{
return "oneit_sec_user_extension";
}
/**
* This is where an object returns the Persistent sets that will
* store it into the database.
* The should be entered into allSets
*/
public void getPersistentSets (PersistentSetCollection allSets)
{
ObjectStatus myStatus = getStatus ();
PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
ObjectID myID = getID();
super.getPersistentSets (allSets);
PersistentSet oneit_sec_user_extensionPSet = allSets.getPersistentSet (myID, "oneit_sec_user_extension", myPSetStatus);
oneit_sec_user_extensionPSet.setAttrib (FIELD_ObjectID, myID);
oneit_sec_user_extensionPSet.setAttrib (FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.toObject (_ForgotPasswordMailSendDate)); //
oneit_sec_user_extensionPSet.setAttrib (FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.toObject (_ForgotPasswordKey)); //
}
/**
* Sets the objects state based on Persistent sets.
*/
public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
{
super.setFromPersistentSets (objectID, allSets);
PersistentSet oneit_sec_user_extensionPSet = allSets.getPersistentSet (objectID, "oneit_sec_user_extension");
_ForgotPasswordMailSendDate = (Date)(HELPER_ForgotPasswordMailSendDate.fromObject (_ForgotPasswordMailSendDate, oneit_sec_user_extensionPSet.getAttrib (FIELD_ForgotPasswordMailSendDate))); //
_ForgotPasswordKey = (String)(HELPER_ForgotPasswordKey.fromObject (_ForgotPasswordKey, oneit_sec_user_extensionPSet.getAttrib (FIELD_ForgotPasswordKey))); //
}
public void setAttributesFrom (BaseBusinessClass other, MultiException e)
{
super.setAttributesFrom (other, e);
if (other instanceof AdminUser)
{
AdminUser otherAdminUser = (AdminUser)other;
try
{
setForgotPasswordMailSendDate (otherAdminUser.getForgotPasswordMailSendDate ());
}
catch (FieldException ex)
{
e.addException (ex);
}
try
{
setForgotPasswordKey (otherAdminUser.getForgotPasswordKey ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
/**
* Set the attributes in this to copies of the attributes in source.
*/
public void copyAttributesFrom (BaseBusinessClass source)
{
super.copyAttributesFrom (source);
if (source instanceof BaseAdminUser)
{
BaseAdminUser sourceAdminUser = (BaseAdminUser)(source);
_ForgotPasswordMailSendDate = sourceAdminUser._ForgotPasswordMailSendDate;
_ForgotPasswordKey = sourceAdminUser._ForgotPasswordKey;
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copySingleAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseAdminUser)
{
BaseAdminUser sourceAdminUser = (BaseAdminUser)(source);
}
}
/**
* Set the associations in this to copies of the attributes in source.
*/
public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
{
super.copyAssociationsFrom (source, linkToGhosts);
if (source instanceof BaseAdminUser)
{
BaseAdminUser sourceAdminUser = (BaseAdminUser)(source);
}
}
public void validate (ValidationContext context)
{
super.validate (context);
}
/**
* Subclasses must override this to read in their attributes
*/
protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
{
super.readExternalData(vals);
_ForgotPasswordMailSendDate = (Date)(HELPER_ForgotPasswordMailSendDate.readExternal (_ForgotPasswordMailSendDate, vals.get(FIELD_ForgotPasswordMailSendDate))); //
_ForgotPasswordKey = (String)(HELPER_ForgotPasswordKey.readExternal (_ForgotPasswordKey, vals.get(FIELD_ForgotPasswordKey))); //
}
/**
* Subclasses must override this to write out their attributes
*/
protected void writeExternalData(Map<String, Object> vals) throws IOException
{
super.writeExternalData(vals);
vals.put (FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.writeExternal (_ForgotPasswordMailSendDate));
vals.put (FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.writeExternal (_ForgotPasswordKey));
}
public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
{
super.compare (other, listener);
if (other instanceof BaseAdminUser)
{
BaseAdminUser otherAdminUser = (BaseAdminUser)(other);
if (!HELPER_ForgotPasswordMailSendDate.compare(this._ForgotPasswordMailSendDate, otherAdminUser._ForgotPasswordMailSendDate))
{
listener.notifyFieldChange(this, other, FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.toObject(this._ForgotPasswordMailSendDate), HELPER_ForgotPasswordMailSendDate.toObject(otherAdminUser._ForgotPasswordMailSendDate));
}
if (!HELPER_ForgotPasswordKey.compare(this._ForgotPasswordKey, otherAdminUser._ForgotPasswordKey))
{
listener.notifyFieldChange(this, other, FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.toObject(this._ForgotPasswordKey), HELPER_ForgotPasswordKey.toObject(otherAdminUser._ForgotPasswordKey));
}
// Compare single assocs
// Compare multiple assocs
}
}
public void visitTransients (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
}
public void visitAttributes (AttributeVisitor visitor) throws StorageException
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.toObject(getForgotPasswordMailSendDate()));
visitor.visitField(this, FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.toObject(getForgotPasswordKey()));
}
public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
{
super.visitAssociations (visitor, scope);
}
public static AdminUser createAdminUser (ObjectTransaction transaction) throws StorageException
{
AdminUser result = new AdminUser ();
result.initialiseNewObject (transaction);
return result;
}
public static AdminUser getAdminUserByID (ObjectTransaction transaction, Long objectID) throws StorageException
{
return (AdminUser)(transaction.getObjectByID (REFERENCE_AdminUser, objectID));
}
public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_ForgotPasswordMailSendDate))
{
return filter.matches (getForgotPasswordMailSendDate ());
}
else if (attribName.equals (FIELD_ForgotPasswordKey))
{
return filter.matches (getForgotPasswordKey ());
}
else
{
return super.testFilter (attribName, filter);
}
}
public static SearchAll SearchByAll () { return new SearchAll (); }
public static class SearchAll extends SearchObject<AdminUser>
{
public SearchAll andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.object_id", FIELD_ObjectID);
return this;
}
public SearchAll andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchAll andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchAll andForgotPasswordMailSendDate (QueryFilter<Date> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.forgot_password_mail_send_date", "ForgotPasswordMailSendDate");
return this;
}
public SearchAll andForgotPasswordKey (QueryFilter<String> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.forgot_password_key", "ForgotPasswordKey");
return this;
}
public SearchAll andUser (QueryFilter<SecUser> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.user_id", "User");
return this;
}
public AdminUser[]
search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_AdminUser, SEARCH_All, criteria);
Set<AdminUser> typedResults = new LinkedHashSet <AdminUser> ();
for (BaseBusinessClass bbcResult : results)
{
AdminUser aResult = (AdminUser)bbcResult;
typedResults.add (aResult);
}
return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new AdminUser[0]);
}
}
public static AdminUser[]
searchAll (ObjectTransaction transaction) throws StorageException
{
return SearchByAll ()
.search (transaction);
}
public static SearchIdPin SearchByIdPin () { return new SearchIdPin (); }
public static class SearchIdPin extends SearchObject<AdminUser>
{
public SearchIdPin byID (Long ID)
{
by ("ID", ID);
return this;
}
public SearchIdPin byPin (String Pin)
{
by ("Pin", Pin);
return this;
}
public SearchIdPin andObjectID (QueryFilter<Long> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.object_id", FIELD_ObjectID);
return this;
}
public SearchIdPin andObjectCreated (QueryFilter<Date> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.object_created_date", FIELD_ObjectCreated);
return this;
}
public SearchIdPin andObjectLastModified (QueryFilter<Date> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.object_last_updated_date", FIELD_ObjectLastModified);
return this;
}
public SearchIdPin andForgotPasswordMailSendDate (QueryFilter<Date> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.forgot_password_mail_send_date", "ForgotPasswordMailSendDate");
return this;
}
public SearchIdPin andForgotPasswordKey (QueryFilter<String> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.forgot_password_key", "ForgotPasswordKey");
return this;
}
public SearchIdPin andUser (QueryFilter<SecUser> filter)
{
filter.addFilter (context, "oneit_sec_user_extension.user_id", "User");
return this;
}
public AdminUser search (ObjectTransaction transaction) throws StorageException
{
BaseBusinessClass[] results = super.search (transaction, REFERENCE_AdminUser, SEARCH_IdPin, criteria);
Set<AdminUser> typedResults = new LinkedHashSet <AdminUser> ();
for (BaseBusinessClass bbcResult : results)
{
AdminUser aResult = (AdminUser)bbcResult;
typedResults.add (aResult);
}
return (AdminUser)singletonResult(ObjstoreUtils.removeDeleted(transaction, typedResults).toArray(new BaseBusinessClass[0]), "AdminUser", "");
}
}
public static AdminUser searchIdPin (ObjectTransaction transaction, Long ID, String Pin) throws StorageException
{
return SearchByIdPin ()
.byID (ID)
.byPin (Pin)
.search (transaction);
}
public Object getAttribute (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_ForgotPasswordMailSendDate))
{
return HELPER_ForgotPasswordMailSendDate.toObject (getForgotPasswordMailSendDate ());
}
else if (attribName.equals (FIELD_ForgotPasswordKey))
{
return HELPER_ForgotPasswordKey.toObject (getForgotPasswordKey ());
}
else
{
return super.getAttribute (attribName);
}
}
public AttributeHelper getAttributeHelper (String attribName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_ForgotPasswordMailSendDate))
{
return HELPER_ForgotPasswordMailSendDate;
}
else if (attribName.equals (FIELD_ForgotPasswordKey))
{
return HELPER_ForgotPasswordKey;
}
else
{
return super.getAttributeHelper (attribName);
}
}
public void setAttribute (String attribName, Object attribValue) throws FieldException
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (attribName.equals (FIELD_ForgotPasswordMailSendDate))
{
setForgotPasswordMailSendDate ((Date)(HELPER_ForgotPasswordMailSendDate.fromObject (_ForgotPasswordMailSendDate, attribValue)));
}
else if (attribName.equals (FIELD_ForgotPasswordKey))
{
setForgotPasswordKey ((String)(HELPER_ForgotPasswordKey.fromObject (_ForgotPasswordKey, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
}
}
public boolean isWriteable (String fieldName)
{
return getWriteable (fieldName) == FieldWriteability.TRUE;
}
public FieldWriteability getWriteable (String fieldName)
{
if (false)
{
throw new RuntimeException ("Game over man!!");
}
else if (fieldName.equals (FIELD_ForgotPasswordMailSendDate))
{
return getWriteability_ForgotPasswordMailSendDate ();
}
else if (fieldName.equals (FIELD_ForgotPasswordKey))
{
return getWriteability_ForgotPasswordKey ();
}
else
{
return super.getWriteable (fieldName);
}
}
public void putUnwriteable (Set<String> fields)
{
if (getWriteability_ForgotPasswordMailSendDate () != FieldWriteability.TRUE)
{
fields.add (FIELD_ForgotPasswordMailSendDate);
}
if (getWriteability_ForgotPasswordKey () != FieldWriteability.TRUE)
{
fields.add (FIELD_ForgotPasswordKey);
}
super.putUnwriteable (fields);
}
public List<AbstractAttribute> getAttributes ()
{
List result = super.getAttributes ();
result.add(HELPER_ForgotPasswordMailSendDate.getAttribObject (getClass (), _ForgotPasswordMailSendDate, false, FIELD_ForgotPasswordMailSendDate));
result.add(HELPER_ForgotPasswordKey.getAttribObject (getClass (), _ForgotPasswordKey, false, FIELD_ForgotPasswordKey));
return result;
}
public Map getAttributeMetadata (String attribute)
{
if (ATTRIBUTES_METADATA_AdminUser.containsKey (attribute))
{
return (Map)ATTRIBUTES_METADATA_AdminUser.get (attribute);
}
else
{
return super.getAttributeMetadata (attribute);
}
}
public Object getAttributeMetadata (String attribute, String metadata)
{
if (ATTRIBUTES_METADATA_AdminUser.containsKey (attribute))
{
return ((Map)ATTRIBUTES_METADATA_AdminUser.get (attribute)).get(metadata);
}
else
{
return super.getAttributeMetadata (attribute, metadata);
}
}
public void preCommit (boolean willBeStored) throws Exception
{
super.preCommit(willBeStored);
if(willBeStored)
{
}
}
public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
{
return super.getBinaryContentHandler(attribName);
}
public static class AdminUserBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<AdminUser>
{
/**
* Get the attribute ForgotPasswordMailSendDate
*/
public Date getForgotPasswordMailSendDate (AdminUser obj, Date original)
{
return original;
}
/**
* Change the value set for attribute ForgotPasswordMailSendDate.
* May modify the field beforehand
* Occurs before validation.
*/
public Date setForgotPasswordMailSendDate (AdminUser obj, Date newForgotPasswordMailSendDate) throws FieldException
{
return newForgotPasswordMailSendDate;
}
/**
* Get the attribute ForgotPasswordKey
*/
public String getForgotPasswordKey (AdminUser obj, String original)
{
return original;
}
/**
* Change the value set for attribute ForgotPasswordKey.
* May modify the field beforehand
* Occurs before validation.
*/
public String setForgotPasswordKey (AdminUser obj, String newForgotPasswordKey) throws FieldException
{
return newForgotPasswordKey;
}
}
public ORMPipeLine pipes()
{
return new AdminUserPipeLineFactory<AdminUser, AdminUser> ((AdminUser)this);
}
/**
* Use this instead of pipes() to get rid of type casting.
*/
public AdminUserPipeLineFactory<AdminUser, AdminUser> pipelineAdminUser()
{
return (AdminUserPipeLineFactory<AdminUser, AdminUser>) pipes();
}
public static AdminUserPipeLineFactory<AdminUser, AdminUser> pipesAdminUser(Collection<AdminUser> items)
{
return REFERENCE_AdminUser.new AdminUserPipeLineFactory<AdminUser, AdminUser> (items);
}
public static AdminUserPipeLineFactory<AdminUser, AdminUser> pipesAdminUser(AdminUser[] _items)
{
return pipesAdminUser(Arrays.asList (_items));
}
public static AdminUserPipeLineFactory<AdminUser, AdminUser> pipesAdminUser()
{
return pipesAdminUser((Collection)null);
}
public class AdminUserPipeLineFactory<From extends BaseBusinessClass, Me extends AdminUser> extends SecUserExtensionPipeLineFactory<From, Me>
{
public <Prev> AdminUserPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
{
super (pipeLine, nextPipe);
}
public AdminUserPipeLineFactory (From seed)
{
super(seed);
}
public AdminUserPipeLineFactory (Collection<From> seed)
{
super(seed);
}
public PipeLine<From, ? extends Object> to(String name)
{
if (name.equals ("ForgotPasswordMailSendDate"))
{
return toForgotPasswordMailSendDate ();
}
if (name.equals ("ForgotPasswordKey"))
{
return toForgotPasswordKey ();
}
return super.to(name);
}
public PipeLine<From, Date> toForgotPasswordMailSendDate () { return pipe(new ORMAttributePipe<Me, Date>(FIELD_ForgotPasswordMailSendDate)); }
public PipeLine<From, String> toForgotPasswordKey () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ForgotPasswordKey)); }
}
public boolean isTransientAttrib(String attribName)
{
return super.isTransientAttrib(attribName);
}
public boolean isTransientSingleReference(String assocName)
{
return super.isTransientSingleReference(assocName);
}
}
class DummyAdminUser extends AdminUser
{
// Default constructor primarily to support Externalisable
public DummyAdminUser()
{
super();
}
public void assertValid ()
{
}
}
...@@ -2,6 +2,7 @@ package performa.utils; ...@@ -2,6 +2,7 @@ package performa.utils;
import java.util.*; import java.util.*;
import javax.activation.DataSource; import javax.activation.DataSource;
import javax.servlet.http.*;
import oneit.email.ConfigurableArticleTemplateEmailer; import oneit.email.ConfigurableArticleTemplateEmailer;
import oneit.email.ConfigurableEmailerException; import oneit.email.ConfigurableEmailerException;
import oneit.logging.LogLevel; import oneit.logging.LogLevel;
...@@ -17,6 +18,13 @@ import performa.orm.*; ...@@ -17,6 +18,13 @@ import performa.orm.*;
import performa.orm.types.Importance; import performa.orm.types.Importance;
import performa.orm.types.JobSortOption; import performa.orm.types.JobSortOption;
import oneit.objstore.utils.*; import oneit.objstore.utils.*;
import oneit.security.jsp.PasswordDIHandler;
import oneit.servlets.forms.RedirectResult;
import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.forms.SuccessfulResult;
import oneit.servlets.orm.DataMap;
import oneit.servlets.process.ORMProcessState;
import oneit.servlets.security.SessionSecUserDecorator;
import oneit.utils.*; import oneit.utils.*;
import oneit.utils.filter.CollectionFilter; import oneit.utils.filter.CollectionFilter;
import oneit.utils.filter.Filter; import oneit.utils.filter.Filter;
...@@ -232,4 +240,30 @@ public class Utils ...@@ -232,4 +240,30 @@ public class Utils
LogMgr.log(LoggingArea.ALL, LogLevel.PROCESSING1, "Mail sent from Utils class to " + Arrays.toString(emails)); LogMgr.log(LoggingArea.ALL, LogLevel.PROCESSING1, "Mail sent from Utils class to " + Arrays.toString(emails));
} }
public static String getPwdKeyOfSecUser(HttpServletRequest request, SecUser user, boolean mandatoryPwd)
{
if(user != null)
{
DataMap dm = DataMap.getDataMap(request, true);
return dm.storeORMHandler(new PasswordDIHandler(user, "md5:" + SecUser.FIELD_Password, mandatoryPwd), user, "md5:" + SecUser.FIELD_Password);
}
return "";
}
public static SuccessfulResult processSuccessfulLogin(ORMProcessState process, SubmissionDetails submission, Map params, SecUser user) throws BusinessException
{
HttpServletRequest request = submission.getRequest();
request.getSession().setAttribute (SecUser.SEC_USER_ID, user);
request.getSession().setAttribute (SessionSecUserDecorator.REFRESH_SECURITY, Boolean.TRUE);
process.completeAndRestart();
return new RedirectResult((String) request.getAttribute("nextPage"), null);
}
} }
...@@ -40,6 +40,7 @@ public class WebUtils ...@@ -40,6 +40,7 @@ public class WebUtils
public static final String UNSUITABLE_APPS = "UnsuitableApps"; public static final String UNSUITABLE_APPS = "UnsuitableApps";
public static final String VIEW_APPLICANTS_GRID = "ViewApplicantsGrid"; public static final String VIEW_APPLICANTS_GRID = "ViewApplicantsGrid";
public static final String APPLICANT_ACCOUNT_VERIFICATION = "ApplicantAccountVerification"; public static final String APPLICANT_ACCOUNT_VERIFICATION = "ApplicantAccountVerification";
public static final String RESET_PASSWORD_ARTICLE = "ResetPasswordEmail";
public static String getArticleLink(HttpServletRequest request, ObjectTransaction objTran, String articleShortcut, String renderMode) public static String getArticleLink(HttpServletRequest request, ObjectTransaction objTran, String articleShortcut, String renderMode)
......
...@@ -54,6 +54,18 @@ ...@@ -54,6 +54,18 @@
<!--<FORM name="*.linkedinOAuthLogin" factory="Participant" class="performa.form.LinkedInOAuthLoginFP"/>--> <!--<FORM name="*.linkedinOAuthLogin" factory="Participant" class="performa.form.LinkedInOAuthLoginFP"/>-->
</NODE> </NODE>
<NODE name="forgot_password_jsp" factory="Participant">
<INHERITS factory="Named" nodename="CoreORMAdminNoPriv"/>
<FORM name="*.forgotPassword" factory="Participant" class="performa.form.ForgotPasswordFP">
<ResetCodeEmailer factory="Participant" class="oneit.email.ConfigurableArticleTemplateEmailer" templateShortcut="ResetCodeEmail"/>
</FORM>
</NODE>
<NODE name="reset_password_jsp" factory="Participant">
<INHERITS factory="Named" nodename="CoreORMAdminNoPriv"/>
<FORM name="*.resetPassword" factory="Participant" class="performa.form.ResetPasswordFP"/>
</NODE>
<NODE name="ORMErrorConfig::ADMIN_PORTAL" factory="Participant" class="oneit.servlets.forms.ErrorReportConfig"> <NODE name="ORMErrorConfig::ADMIN_PORTAL" factory="Participant" class="oneit.servlets.forms.ErrorReportConfig">
<format item="field.*.error.pageHeader_performa_errorPrefix"> <format item="field.*.error.pageHeader_performa_errorPrefix">
<![CDATA[<div class="error-message message-common"><img src="${contextRoot}/images/error-alert.png" class="alert-icon" /><span class="message-txt" style="font-weight: bold">${translateLabel:Errors_Occurred:Errors occurred, please correct them and try again}</span><br/>]]> <![CDATA[<div class="error-message message-common"><img src="${contextRoot}/images/error-alert.png" class="alert-icon" /><span class="message-txt" style="font-weight: bold">${translateLabel:Errors_Occurred:Errors occurred, please correct them and try again}</span><br/>]]>
......
<%@ page extends="oneit.servlets.jsp.FormJSP" %>
<%@ include file="/setuprequest.jsp" %>
<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<%! protected String getName (ServletConfig config) { return "forgot_password_jsp"; } %>
<html lang="en">
<head>
<meta charset="utf-8"></meta>
<meta http-equiv="X-UA-Compatible" content="IE=edge"></meta>
<meta name="viewport" content="width=device-width, initial-scale=1"></meta>
<title>Talentology</title>
<%@include file="/inc/std_imports.jsp" %>
</head>
<body class="bg-color">
<script type="text/javascript">
$(document).ready(function() {
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) {
$('.send-btn').attr('disabled', 'disabled');
} else {
$('.send-btn').removeAttr('disabled');
}
}
</script>
<style>
button[disabled] {
opacity: 0.6;
background-color: #0582ba;
}
</style>
<div class="container">
<div class="row">
<div class="main-verify-identity">
<div class="login-logo"><img src="<%= request.getContextPath() %>/images/logo.svg" /></div>
<oneit:form name="forgotPassword" method="post">
<oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/>
<div class="main-box-layout login-box">
<div class="text-left">
<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>&nbsp;</div>
<div class="form-group text-left">
<label>Email Address</label>
<input type="email" class="form-control" name="email" required>
</div>
<div class="form-group">
<oneit:button value="Send" name="forgotPassword" cssClass="box-btn send-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", "sign_in.jsp?sent=true")
.mapEntry(NotificationUtils.NOTIFICATION_MSG_PARAM, "resetPasswordEmailSent")
.toMap() %>"/>
</div>
</div>
</oneit:form>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
#atleastOneRequirement = Please add at least one Requirement. #atleastOneRequirement = Please add at least one Requirement.
#exceedMaxShortlisted = Selected number of applications exceed maximum shortlist application count #exceedMaxShortlisted = Selected number of applications exceed maximum shortlist application count
#saveTemplateFirst = Please save template first, before proceeding to the next step #saveTemplateFirst = Please save template first, before proceeding to the next step
#passwordNotMatch = The password does not match. Please try again. #passwordNotMatch = The password does not match. Please try again.
\ No newline at end of file #resetPasswordEmailSent = A password rest email has been sent to you. Please check your email.
\ No newline at end of file
<%@ page extends="oneit.servlets.jsp.FormJSP" %>
<%@ include file="/setuprequest.jsp" %>
<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<%! protected String getName (ServletConfig config) { return "reset_password_jsp"; } %>
<%
ORMProcessState process = (ORMProcessState)ProcessDecorator.getDefaultProcess(request);
String adminUserID = (String) process.getAttribute("adminUserID"); //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)
{
adminUserID = request.getParameter("id");
process.setAttribute("adminUserID", adminUserID);
}
if(request.getParameter("key")!=null)
{
forgotpasswordCode = request.getParameter("key");
process.setAttribute("forgotpasswordCode", forgotpasswordCode);
}
if(StringUtils.subBlanks(adminUserID) != null)
{
AdminUser adminUser = AdminUser.getAdminUserForForgotPassword(process.getTransaction(), adminUserID, forgotpasswordCode);
if(adminUser != null)
{
user = adminUser.getUser();
if(StringUtils.subBlanks(forgotpasswordCode) != null)
{
RandomStringGen random = new RandomStringGen();
user.setAttribute("md5:Password", random.generateAlphaNum(8));
}
process.setAttribute("SecUser", user);
}
}
%>
<html lang="en">
<head>
<meta charset="utf-8"></meta>
<meta http-equiv="X-UA-Compatible" content="IE=edge"></meta>
<meta name="viewport" content="width=device-width, initial-scale=1"></meta>
<title>Talentology</title>
<%@include file="/inc/std_imports.jsp" %>
</head>
<body class="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 ($( 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>
<div class="container">
<div class="row">
<div class="main-verify-identity">
<div class="login-logo"><img src="<%= request.getContextPath() %>/images/logo.svg" /></div>
<oneit:form name="resetPassword" method="post">
<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" style="text-align: right">
<oneit:button value="Set New Password" name="resetPassword" cssClass="box-btn reset-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage).toMap() %>"/>
</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>
</div>
</div>
</div>
</body>
</html>
...@@ -63,6 +63,8 @@ ...@@ -63,6 +63,8 @@
<oneit:form name="login" method="post"> <oneit:form name="login" 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%>"/>
<div class="main-box-layout login-box">
<div class="form-group text-left"> <div class="form-group text-left">
<label>Email Address</label> <label>Email Address</label>
<input type="text" class="form-control" name="username" required> <input type="text" class="form-control" name="username" required>
...@@ -72,8 +74,9 @@ ...@@ -72,8 +74,9 @@
<input type="password" class="form-control" name="password" required> <input type="password" class="form-control" name="password" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<oneit:button value="Forgot password?" name="gotoPage" cssClass="forgot-pass" skin="link"
<a href="#" class="forgot-pass" style="display: none">Forgot password?</a> requestAttribs="<%= CollectionUtils.mapEntry("nextPage", "forgot_password.jsp")
.toMap() %>"></oneit:button>
<oneit:button value="Sign in" name="login" cssClass="box-btn login-btn" <oneit:button value="Sign in" name="login" cssClass="box-btn login-btn"
requestAttribs="<%= CollectionUtils.EMPTY_MAP%>"/> requestAttribs="<%= CollectionUtils.EMPTY_MAP%>"/>
...@@ -105,6 +108,7 @@ ...@@ -105,6 +108,7 @@
</ul> </ul>
</oneit:form> </oneit:form>
</div> </div>
</oneit:form>
<footer class="power-footer"> <footer class="power-footer">
<div class="footer-link text-center"> <div class="footer-link text-center">
<ul> <ul>
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS xmlns:oneit="http://www.1iT.com.au" name="">
<NODE factory="Vector" name="Script"><NODE class="oneit.appservices.upgrade.cms.CMSArticleUpdateOperation" factory="Participant" name="Reset Code Email">
<createSpecificIdentifier factory='String' value='WFDXIOQKNEMOGB6ZGPF8XV08WZZAHO'/>
<articleIdentifiers factory="Array" class="java.lang.String">
<NODE factory="String" value="WFDXIOQKNEMOGB6ZGPF8XV08WZZAHO"/>
</articleIdentifiers>
<createdLabel factory="String" value="WFDXIOQKNEMOGB6ZGPF8XV08WZZAHO"/>
<articleAttributeChanges factory="Map">
<NODE name="EmailTo" factory="Null"/>
<NODE name="EmailFrom" factory="String" value="info@talentology.com.au"/>
<NODE name="EmailSubject" factory="String" value="Password reset code"/>
<NODE name="Shortcuts" factory="String" value="ResetCodeEmail"/>
<NODE name="EmailCC" factory="Null"/>
<NODE name="EmailBCC" factory="Null"/>
</articleAttributeChanges>
<ormAttributeChanges factory="Map">
<NODE name="PublishDate" factory="Date" value="2016-02-05 00:00:00"/>
<NODE name="WithdrawDate" factory="Date" value="2066-02-05 16:00:00"/>
<NODE name="Title" factory="String" value="Reset Code Email"/>
<NODE name="ShortTitle" factory="String" value="Reset Code Email"/>
<NODE name="SortOrder" factory="Integer" value="-200926"/>
<NODE name="Type" factory="Enumerated" class="oneit.business.content.ArticleType" value="ARTICLE"/>
<NODE name="Template" factory="Enumerated" class="oneit.business.content.ArticleTemplate" value="EMAIL_TEMPLATE"/>
</ormAttributeChanges>
<content factory="Map"> <NODE name="EmailBody" factory="Map">
<NODE name="Content" factory="String"><![CDATA[<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="HTML Tidy, see www.w3.org" name="generator">
<title></title>
</head>
<body>
<p>Hello,</p>
<p>We have received request&nbsp;to reset your&nbsp;account&nbsp;password.</p>
<p>Click below link to reset your password.</p>
<p>
<a href="${url}">Reset Passsword</a>
</p>
<p>Thank You.</p>
</body>
</html>
]]></NODE>
<NODE name="TransformedContent" factory="String"><![CDATA[<p>Hello,</p><p>We have received request&nbsp;to reset your&nbsp;account&nbsp;password.</p><p>Click below link to reset your password.</p><p>
<a href="${url}">Reset Passsword</a>
</p><p>Thank You.</p>
]]></NODE>
<NODE name="IncludeContent" factory="Boolean" value="true"/>
</NODE>
<NODE name="" factory="Map">
<NODE name="Content" factory="String"><![CDATA[
<p></p>
]]></NODE>
<NODE name="IncludeContent" factory="Boolean" value="true"/>
</NODE>
</content>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<MAP code="TestInput" class="performa.orm.TestInput"/> <MAP code="TestInput" class="performa.orm.TestInput"/>
<MAP code="JobApplication" class="performa.orm.JobApplication"/> <MAP code="JobApplication" class="performa.orm.JobApplication"/>
<MAP code="Candidate" class="performa.orm.Candidate"/> <MAP code="Candidate" class="performa.orm.Candidate"/>
<MAP code="AdminUser" class="performa.orm.AdminUser"/>
</NODE> </NODE>
</OBJECTS> </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