Merged in marcoAntonioNina/processmaker/BUG-15561 (pull request #811)

BUG-15561 Cambiar el algoritmo o metodo de cifrado... IMPROVEMENT
This commit is contained in:
Julio Cesar Laura Avendaño
2014-09-23 10:50:34 -04:00
23 changed files with 2174 additions and 1936 deletions

View File

@@ -2859,5 +2859,30 @@ class Bootstrap
die();
}
}
public function hasPassword($pass, $previous=false) {
$passEncrypt = md5($pass);
try {
require_once PATH_CORE .'methods' . PATH_SEP .'enterprise/enterprise.php';
$passEncrypt = enterprisePlugin::hashPassword($pass, $previous);
} catch (Exception $e) {
}
return $passEncrypt;
}
public function verifyHashPassword ($pass, $userPass)
{
//$verify = Bootstrap::hasPassword($pass);
if (Bootstrap::hasPassword($pass) == $userPass) {
return true;
}
if (Bootstrap::hasPassword($pass, true) == $userPass) {
return true;
}
return false;
}
}

View File

@@ -80,10 +80,8 @@ class RbacUsers extends BaseRbacUsers
if (is_array($rs) && isset($rs[0]) && is_object($rs[0]) && get_class($rs[0]) == 'RbacUsers') {
$aFields = $rs[0]->toArray(BasePeer::TYPE_FIELDNAME);
//verify password with md5, and md5 format
//if ( $aFields['USR_PASSWORD'] == md5 ($sPassword ) ) {
if (mb_strtoupper($sUsername, 'utf-8') === mb_strtoupper($aFields['USR_USERNAME'], 'utf-8')) {
if ($aFields['USR_PASSWORD'] == md5($sPassword) ||
'md5:' . $aFields['USR_PASSWORD'] === $sPassword) {
if( Bootstrap::verifyHashPassword($sPassword, $aFields['USR_PASSWORD']) ) {
if ($aFields['USR_DUE_DATE'] < date('Y-m-d')) {
return -4;
}

View File

@@ -5,7 +5,7 @@ include_once 'creole/CreoleTypes.php';
/**
* This class adds structure of 'USERS' table to 'rbac' DatabaseMap object.
* This class adds structure of 'RBAC_USERS' table to 'rbac' DatabaseMap object.
*
*
*
@@ -14,9 +14,10 @@ include_once 'creole/CreoleTypes.php';
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package rbac-classes-model
* @package workflow.classes.model.map
*/
class RbacUsersMapBuilder {
class RbacUsersMapBuilder
{
/**
* The (dot-path) name of this class
@@ -68,7 +69,7 @@ class RbacUsersMapBuilder {
$tMap->addColumn('USR_USERNAME', 'UsrUsername', 'string', CreoleTypes::VARCHAR, true, 100);
$tMap->addColumn('USR_PASSWORD', 'UsrPassword', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('USR_PASSWORD', 'UsrPassword', 'string', CreoleTypes::VARCHAR, true, 128);
$tMap->addColumn('USR_FIRSTNAME', 'UsrFirstname', 'string', CreoleTypes::VARCHAR, true, 50);

View File

@@ -10,14 +10,14 @@ include_once 'propel/util/Criteria.php';
include_once 'classes/model/RbacUsersPeer.php';
/**
* Base class that represents a row from the 'USERS' table.
* Base class that represents a row from the 'RBAC_USERS' table.
*
*
*
* @package rbac-classes-model
* @package workflow.classes.model.om
*/
abstract class BaseRbacUsers extends BaseObject implements Persistent {
abstract class BaseRbacUsers extends BaseObject implements Persistent
{
/**
* The Peer class.
@@ -27,98 +27,84 @@ abstract class BaseRbacUsers extends BaseObject implements Persistent {
*/
protected static $peer;
/**
* The value for the usr_uid field.
* @var string
*/
protected $usr_uid = '';
/**
* The value for the usr_username field.
* @var string
*/
protected $usr_username = '';
/**
* The value for the usr_password field.
* @var string
*/
protected $usr_password = '';
/**
* The value for the usr_firstname field.
* @var string
*/
protected $usr_firstname = '';
/**
* The value for the usr_lastname field.
* @var string
*/
protected $usr_lastname = '';
/**
* The value for the usr_email field.
* @var string
*/
protected $usr_email = '';
/**
* The value for the usr_due_date field.
* @var int
*/
protected $usr_due_date;
/**
* The value for the usr_create_date field.
* @var int
*/
protected $usr_create_date;
/**
* The value for the usr_update_date field.
* @var int
*/
protected $usr_update_date;
/**
* The value for the usr_status field.
* @var int
*/
protected $usr_status = 1;
/**
* The value for the usr_auth_type field.
* @var string
*/
protected $usr_auth_type = '';
/**
* The value for the uid_auth_source field.
* @var string
*/
protected $uid_auth_source = '';
/**
* The value for the usr_auth_user_dn field.
* @var string
*/
protected $usr_auth_user_dn = '';
/**
* The value for the usr_auth_supervisor_dn field.
* @var string
@@ -221,8 +207,9 @@ abstract class BaseRbacUsers extends BaseObject implements Persistent {
} elseif (!is_int($this->usr_due_date)) {
// a non-timestamp value was set externally, so we convert it
$ts = strtotime($this->usr_due_date);
if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
throw new PropelException("Unable to parse value of [usr_due_date] as date/time value: " . var_export($this->usr_due_date, true));
if ($ts === -1 || $ts === false) {
throw new PropelException("Unable to parse value of [usr_due_date] as date/time value: " .
var_export($this->usr_due_date, true));
}
} else {
$ts = $this->usr_due_date;
@@ -252,8 +239,9 @@ abstract class BaseRbacUsers extends BaseObject implements Persistent {
} elseif (!is_int($this->usr_create_date)) {
// a non-timestamp value was set externally, so we convert it
$ts = strtotime($this->usr_create_date);
if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
throw new PropelException("Unable to parse value of [usr_create_date] as date/time value: " . var_export($this->usr_create_date, true));
if ($ts === -1 || $ts === false) {
throw new PropelException("Unable to parse value of [usr_create_date] as date/time value: " .
var_export($this->usr_create_date, true));
}
} else {
$ts = $this->usr_create_date;
@@ -283,8 +271,9 @@ abstract class BaseRbacUsers extends BaseObject implements Persistent {
} elseif (!is_int($this->usr_update_date)) {
// a non-timestamp value was set externally, so we convert it
$ts = strtotime($this->usr_update_date);
if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
throw new PropelException("Unable to parse value of [usr_update_date] as date/time value: " . var_export($this->usr_update_date, true));
if ($ts === -1 || $ts === false) {
throw new PropelException("Unable to parse value of [usr_update_date] as date/time value: " .
var_export($this->usr_update_date, true));
}
} else {
$ts = $this->usr_update_date;
@@ -496,8 +485,13 @@ abstract class BaseRbacUsers extends BaseObject implements Persistent {
if ($v !== null && !is_int($v)) {
$ts = strtotime($v);
if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
throw new PropelException("Unable to parse date/time value for [usr_due_date] from input: " . var_export($v, true));
//Date/time accepts null values
if ($v == '') {
$ts = null;
}
if ($ts === -1 || $ts === false) {
throw new PropelException("Unable to parse date/time value for [usr_due_date] from input: " .
var_export($v, true));
}
} else {
$ts = $v;
@@ -520,8 +514,13 @@ abstract class BaseRbacUsers extends BaseObject implements Persistent {
if ($v !== null && !is_int($v)) {
$ts = strtotime($v);
if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
throw new PropelException("Unable to parse date/time value for [usr_create_date] from input: " . var_export($v, true));
//Date/time accepts null values
if ($v == '') {
$ts = null;
}
if ($ts === -1 || $ts === false) {
throw new PropelException("Unable to parse date/time value for [usr_create_date] from input: " .
var_export($v, true));
}
} else {
$ts = $v;
@@ -544,8 +543,13 @@ abstract class BaseRbacUsers extends BaseObject implements Persistent {
if ($v !== null && !is_int($v)) {
$ts = strtotime($v);
if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
throw new PropelException("Unable to parse date/time value for [usr_update_date] from input: " . var_export($v, true));
//Date/time accepts null values
if ($v == '') {
$ts = null;
}
if ($ts === -1 || $ts === false) {
throw new PropelException("Unable to parse date/time value for [usr_update_date] from input: " .
var_export($v, true));
}
} else {
$ts = $v;
@@ -760,7 +764,7 @@ abstract class BaseRbacUsers extends BaseObject implements Persistent {
* wraps the doSave() worker method in a transaction.
*
* @param Connection $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @return int The number of rows affected by this insert/update
* @throws PropelException
* @see doSave()
*/
@@ -792,7 +796,7 @@ abstract class BaseRbacUsers extends BaseObject implements Persistent {
* All related objects are also updated in this method.
*
* @param Connection $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @return int The number of rows affected by this insert/update and any referring
* @throws PropelException
* @see save()
*/
@@ -872,7 +876,8 @@ abstract class BaseRbacUsers extends BaseObject implements Persistent {
* an aggreagated array of ValidationFailed objects will be returned.
*
* @param array $columns Array of column names to validate.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
* @return mixed <code>true</code> if all validations pass;
array of <code>ValidationFailed</code> objects otherwise.
*/
protected function doValidate($columns = null)
{
@@ -1092,20 +1097,62 @@ abstract class BaseRbacUsers extends BaseObject implements Persistent {
{
$keys = RbacUsersPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setUsrUid($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setUsrUsername($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setUsrPassword($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setUsrFirstname($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUsrLastname($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setUsrEmail($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setUsrDueDate($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setUsrCreateDate($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setUsrUpdateDate($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setUsrStatus($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setUsrAuthType($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setUidAuthSource($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setUsrAuthUserDn($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setUsrAuthSupervisorDn($arr[$keys[13]]);
if (array_key_exists($keys[0], $arr)) {
$this->setUsrUid($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setUsrUsername($arr[$keys[1]]);
}
if (array_key_exists($keys[2], $arr)) {
$this->setUsrPassword($arr[$keys[2]]);
}
if (array_key_exists($keys[3], $arr)) {
$this->setUsrFirstname($arr[$keys[3]]);
}
if (array_key_exists($keys[4], $arr)) {
$this->setUsrLastname($arr[$keys[4]]);
}
if (array_key_exists($keys[5], $arr)) {
$this->setUsrEmail($arr[$keys[5]]);
}
if (array_key_exists($keys[6], $arr)) {
$this->setUsrDueDate($arr[$keys[6]]);
}
if (array_key_exists($keys[7], $arr)) {
$this->setUsrCreateDate($arr[$keys[7]]);
}
if (array_key_exists($keys[8], $arr)) {
$this->setUsrUpdateDate($arr[$keys[8]]);
}
if (array_key_exists($keys[9], $arr)) {
$this->setUsrStatus($arr[$keys[9]]);
}
if (array_key_exists($keys[10], $arr)) {
$this->setUsrAuthType($arr[$keys[10]]);
}
if (array_key_exists($keys[11], $arr)) {
$this->setUidAuthSource($arr[$keys[11]]);
}
if (array_key_exists($keys[12], $arr)) {
$this->setUsrAuthUserDn($arr[$keys[12]]);
}
if (array_key_exists($keys[13], $arr)) {
$this->setUsrAuthSupervisorDn($arr[$keys[13]]);
}
}
/**
@@ -1117,20 +1164,62 @@ abstract class BaseRbacUsers extends BaseObject implements Persistent {
{
$criteria = new Criteria(RbacUsersPeer::DATABASE_NAME);
if ($this->isColumnModified(RbacUsersPeer::USR_UID)) $criteria->add(RbacUsersPeer::USR_UID, $this->usr_uid);
if ($this->isColumnModified(RbacUsersPeer::USR_USERNAME)) $criteria->add(RbacUsersPeer::USR_USERNAME, $this->usr_username);
if ($this->isColumnModified(RbacUsersPeer::USR_PASSWORD)) $criteria->add(RbacUsersPeer::USR_PASSWORD, $this->usr_password);
if ($this->isColumnModified(RbacUsersPeer::USR_FIRSTNAME)) $criteria->add(RbacUsersPeer::USR_FIRSTNAME, $this->usr_firstname);
if ($this->isColumnModified(RbacUsersPeer::USR_LASTNAME)) $criteria->add(RbacUsersPeer::USR_LASTNAME, $this->usr_lastname);
if ($this->isColumnModified(RbacUsersPeer::USR_EMAIL)) $criteria->add(RbacUsersPeer::USR_EMAIL, $this->usr_email);
if ($this->isColumnModified(RbacUsersPeer::USR_DUE_DATE)) $criteria->add(RbacUsersPeer::USR_DUE_DATE, $this->usr_due_date);
if ($this->isColumnModified(RbacUsersPeer::USR_CREATE_DATE)) $criteria->add(RbacUsersPeer::USR_CREATE_DATE, $this->usr_create_date);
if ($this->isColumnModified(RbacUsersPeer::USR_UPDATE_DATE)) $criteria->add(RbacUsersPeer::USR_UPDATE_DATE, $this->usr_update_date);
if ($this->isColumnModified(RbacUsersPeer::USR_STATUS)) $criteria->add(RbacUsersPeer::USR_STATUS, $this->usr_status);
if ($this->isColumnModified(RbacUsersPeer::USR_AUTH_TYPE)) $criteria->add(RbacUsersPeer::USR_AUTH_TYPE, $this->usr_auth_type);
if ($this->isColumnModified(RbacUsersPeer::UID_AUTH_SOURCE)) $criteria->add(RbacUsersPeer::UID_AUTH_SOURCE, $this->uid_auth_source);
if ($this->isColumnModified(RbacUsersPeer::USR_AUTH_USER_DN)) $criteria->add(RbacUsersPeer::USR_AUTH_USER_DN, $this->usr_auth_user_dn);
if ($this->isColumnModified(RbacUsersPeer::USR_AUTH_SUPERVISOR_DN)) $criteria->add(RbacUsersPeer::USR_AUTH_SUPERVISOR_DN, $this->usr_auth_supervisor_dn);
if ($this->isColumnModified(RbacUsersPeer::USR_UID)) {
$criteria->add(RbacUsersPeer::USR_UID, $this->usr_uid);
}
if ($this->isColumnModified(RbacUsersPeer::USR_USERNAME)) {
$criteria->add(RbacUsersPeer::USR_USERNAME, $this->usr_username);
}
if ($this->isColumnModified(RbacUsersPeer::USR_PASSWORD)) {
$criteria->add(RbacUsersPeer::USR_PASSWORD, $this->usr_password);
}
if ($this->isColumnModified(RbacUsersPeer::USR_FIRSTNAME)) {
$criteria->add(RbacUsersPeer::USR_FIRSTNAME, $this->usr_firstname);
}
if ($this->isColumnModified(RbacUsersPeer::USR_LASTNAME)) {
$criteria->add(RbacUsersPeer::USR_LASTNAME, $this->usr_lastname);
}
if ($this->isColumnModified(RbacUsersPeer::USR_EMAIL)) {
$criteria->add(RbacUsersPeer::USR_EMAIL, $this->usr_email);
}
if ($this->isColumnModified(RbacUsersPeer::USR_DUE_DATE)) {
$criteria->add(RbacUsersPeer::USR_DUE_DATE, $this->usr_due_date);
}
if ($this->isColumnModified(RbacUsersPeer::USR_CREATE_DATE)) {
$criteria->add(RbacUsersPeer::USR_CREATE_DATE, $this->usr_create_date);
}
if ($this->isColumnModified(RbacUsersPeer::USR_UPDATE_DATE)) {
$criteria->add(RbacUsersPeer::USR_UPDATE_DATE, $this->usr_update_date);
}
if ($this->isColumnModified(RbacUsersPeer::USR_STATUS)) {
$criteria->add(RbacUsersPeer::USR_STATUS, $this->usr_status);
}
if ($this->isColumnModified(RbacUsersPeer::USR_AUTH_TYPE)) {
$criteria->add(RbacUsersPeer::USR_AUTH_TYPE, $this->usr_auth_type);
}
if ($this->isColumnModified(RbacUsersPeer::UID_AUTH_SOURCE)) {
$criteria->add(RbacUsersPeer::UID_AUTH_SOURCE, $this->uid_auth_source);
}
if ($this->isColumnModified(RbacUsersPeer::USR_AUTH_USER_DN)) {
$criteria->add(RbacUsersPeer::USR_AUTH_USER_DN, $this->usr_auth_user_dn);
}
if ($this->isColumnModified(RbacUsersPeer::USR_AUTH_SUPERVISOR_DN)) {
$criteria->add(RbacUsersPeer::USR_AUTH_SUPERVISOR_DN, $this->usr_auth_supervisor_dn);
}
return $criteria;
}
@@ -1255,5 +1344,5 @@ abstract class BaseRbacUsers extends BaseObject implements Persistent {
}
return self::$peer;
}
}
} // BaseRbacUsers

View File

@@ -6,13 +6,14 @@ require_once 'propel/util/BasePeer.php';
//include_once 'classes/model/RbacUsers.php';
/**
* Base static class for performing query and update operations on the 'USERS' table.
* Base static class for performing query and update operations on the 'RBAC_USERS' table.
*
*
*
* @package rbac-classes-model
* @package workflow.classes.model.om
*/
abstract class BaseRbacUsersPeer {
abstract class BaseRbacUsersPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'rbac';
@@ -255,8 +256,7 @@ abstract class BaseRbacUsersPeer {
}
// just in case we're grouping: add those columns to the select statement
foreach($criteria->getGroupByColumns() as $column)
{
foreach ($criteria->getGroupByColumns() as $column) {
$criteria->addSelectColumn($column);
}
@@ -424,8 +424,8 @@ abstract class BaseRbacUsersPeer {
/**
* Method perform an UPDATE on the database, given a RbacUsers or Criteria object.
*
* @param mixed $values Criteria or RbacUsers object containing data that is used to create the UPDATE statement.
* @param Connection $con The connection to use (specify Connection object to exert more control over transactions).
* @param mixed $values Criteria or RbacUsers object containing data create the UPDATE statement.
* @param Connection $con The connection to use (specify Connection exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
@@ -444,7 +444,7 @@ abstract class BaseRbacUsersPeer {
$comparison = $criteria->getComparison(RbacUsersPeer::USR_UID);
$selectCriteria->add(RbacUsersPeer::USR_UID, $criteria->remove(RbacUsersPeer::USR_UID), $comparison);
} else { // $values is RbacUsers object
} else {
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
@@ -456,7 +456,7 @@ abstract class BaseRbacUsersPeer {
}
/**
* Method to DELETE all rows from the USERS table.
* Method to DELETE all rows from the RBAC_USERS table.
*
* @return int The number of affected rows (if supported by underlying database driver).
*/
@@ -485,7 +485,8 @@ abstract class BaseRbacUsersPeer {
* @param mixed $values Criteria or RbacUsers object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param Connection $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* @return int The number of affected rows (if supported by underlying database driver).
* This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
@@ -610,8 +611,8 @@ abstract class BaseRbacUsersPeer {
}
return $objs;
}
}
} // BaseRbacUsersPeer
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
@@ -628,3 +629,4 @@ if (Propel::isInit()) {
require_once 'classes/model/map/RbacUsersMapBuilder.php';
Propel::registerMapBuilder('classes.model.map.RbacUsersMapBuilder');
}

View File

@@ -132,7 +132,7 @@
</vendor>
<column name="USR_UID" type="VARCHAR" size="32" required="true" primaryKey="true" default="" />
<column name="USR_USERNAME" type="VARCHAR" size="100" required="true" default="" />
<column name="USR_PASSWORD" type="VARCHAR" size="32" required="true" default="" />
<column name="USR_PASSWORD" type="VARCHAR" size="128" required="true" default="" />
<column name="USR_FIRSTNAME" type="VARCHAR" size="50" required="true" default="" />
<column name="USR_LASTNAME" type="VARCHAR" size="50" required="true" default="" />
<column name="USR_EMAIL" type="VARCHAR" size="100" required="true" default="" />

View File

@@ -19,6 +19,15 @@ EOT
}
*/
CLI::taskName('change-password-hash-method');
CLI::taskDescription(<<<EOT
Create .po file for the plugin
EOT
);
CLI::taskArg('workspace', false);
CLI::taskArg('hash', false);
CLI::taskRun("change_hash");
//function run_addon_install($args, $opts) {
function run_addon_install($args)
{
@@ -92,3 +101,46 @@ function run_addon_install($args)
//echo "** Installation finished\n";
}
function change_hash($command, $opts)
{
if (count($command) < 2) {
$hash = 'md5';
} else {
$hash = array_pop($command);
}
$workspaces = get_workspaces_from_args($command);
require_once (PATH_GULLIVER . PATH_SEP . 'class.bootstrap.php');
Bootstrap::LoadClass("plugin");
foreach ($workspaces as $workspace) {
CLI::logging("Checking workspace: ".pakeColor::colorize($workspace->name, "INFO")."\n");
$path = PATH_DATA . 'sites' . PATH_SEP . $workspace->name . PATH_SEP;
try {
if (file_exists($path . 'plugin.singleton')) {
define('SYS_SYS', $workspace->name);
define('PATH_DATA_SITE', $path);
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->setupPlugins();
$oPluginRegistry->unSerializeInstance(file_get_contents($path . 'plugin.singleton'));
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->unSerializeInstance(file_get_contents($path . 'plugin.singleton'));
if ($oPluginRegistry->existsTrigger ( PM_HASH_PASSWORD )) {
$response = new stdclass();
$response->workspace = $workspace;
$response->hash = $hash;
$workspace->changeHashPassword($workspace->name, $response);
$workspace->close();
CLI::logging(pakeColor::colorize("Changed...", "ERROR") . "\n");
} else {
CLI::logging(pakeColor::colorize("You can't use the \"change-password-hash-method\" option because the license has expired or your workspace doesn't have the Enteprise plugin enabled.", "ERROR") . "\n");
}
} else {
CLI::logging(pakeColor::colorize("You can't use the \"change-password-hash-method\" option because the license has expired or your workspace doesn't have the Enteprise plugin enabled.", "INFO") . "\n");
}
} catch (Exception $e) {
echo "> Error: ".CLI::error($e->getMessage()) . "\n";
}
}
}

View File

@@ -1,5 +1,5 @@
<?php
require_once (PATH_PLUGINS . "enterprise" . PATH_SEP . "classes" . PATH_SEP . "class.enterpriseUtils.php");
require_once ("classes" . PATH_SEP . "class.enterpriseUtils.php");
if (!defined("PM_VERSION")) {
if (file_exists(PATH_METHODS . "login/version-pmos.php")) {
@@ -13,7 +13,7 @@ class enterpriseClass extends PMPlugin
{
public function __construct()
{
set_include_path(PATH_PLUGINS . 'enterprise' . PATH_SEPARATOR . get_include_path());
set_include_path(PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEPARATOR . get_include_path());
}
public function getFieldsForPageSetup()
@@ -117,9 +117,48 @@ class enterpriseClass extends PMPlugin
}
}
}
public function setHashPassword ($object)
{
$type = array('md5', 'sha256');
if (!in_array($object->hash, $type)) {
throw new Exception( 'Type: ' . $object->hash. ' No valid.');
return false;
}
G::LoadClass( "configuration" );
$config = new Configurations();
$typeEncrypt = $config->getConfiguration('ENTERPRISE_SETTING_ENCRYPT', '');
if ($typeEncrypt == null) {
$typeEncrypt = array('current' => $object->hash, 'previous' => 'md5');
} else {
$typeEncrypt['previous'] = $typeEncrypt['current'];
$typeEncrypt['current'] = $object->hash;
}
if ($object->hash != $typeEncrypt['previous']) {
$config->aConfig = $typeEncrypt;
$config->saveConfig('ENTERPRISE_SETTING_ENCRYPT', '');
}
require_once 'classes/model/RbacUsersPeer.php';
require_once 'classes/model/UsersProperties.php';
$userProperty = new UsersProperties();
$criteria = new Criteria($object->workspace->dbInfo['DB_RBAC_NAME']);
$criteria->add(RbacUsersPeer::USR_STATUS, 0, Criteria::NOT_EQUAL);
$dataset = RbacUsersPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($dataset->next()) {
$row = $dataset->getRow();
$property = $userProperty->loadOrCreateIfNotExists($row['USR_UID'], array());
$property['USR_LOGGED_NEXT_TIME'] = 1;
$userProperty->update($property);
}
}
}
if (!class_exists("pmLicenseManager")) {
require_once (PATH_PLUGINS . 'enterprise/class.pmLicenseManager.php');
require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php");
}

View File

@@ -43,8 +43,7 @@ define('PM_SINGLE_SIGN_ON', 1014);
define('PM_GET_CASES_AJAX_LISTENER', 1015);
define('PM_BEFORE_CREATE_USER', 1016);
define('PM_AFTER_LOGIN', 1017);
define('PM_HASH_PASSWORD', 1018);
/**
* @package workflow.engine.classes

View File

@@ -985,7 +985,7 @@ class PMPluginRegistry
$classFile = '';
foreach ($this->_aFolders as $row => $folder) {
$fname = PATH_PLUGINS . $folder->sFolderName . PATH_SEP . 'class.' . $folder->sFolderName . '.php';
$fname = $folder->sNamespace == 'enterprise' ? PATH_CORE . 'classes' . PATH_SEP . 'class.' . $folder->sFolderName . '.php' : PATH_PLUGINS . $folder->sFolderName . PATH_SEP . 'class.' . $folder->sFolderName . '.php';
if ($detail->sNamespace == $folder->sNamespace && file_exists( $fname )) {
$found = true;
$classFile = $fname;
@@ -1021,11 +1021,12 @@ class PMPluginRegistry
if ($triggerId == $detail->sTriggerId) {
//review all folders registered for this namespace
foreach ($this->_aFolders as $row => $folder) {
$fname = PATH_PLUGINS . $folder->sFolderName . PATH_SEP . 'class.' . $folder->sFolderName . '.php';
$fname = $folder->sNamespace == 'enterprise' ? PATH_CORE . 'classes' . PATH_SEP . 'class.' . $folder->sFolderName . '.php' : PATH_PLUGINS . $folder->sFolderName . PATH_SEP . 'class.' . $folder->sFolderName . '.php';
if ($detail->sNamespace == $folder->sNamespace && file_exists( $fname )) {
$found = true;
}
}
}
}
return $found;

View File

@@ -1189,7 +1189,7 @@ class wsBase
$arrayData = array ();
$arrayData["USR_USERNAME"] = $userName;
$arrayData["USR_PASSWORD"] = md5( $password );
$arrayData["USR_PASSWORD"] = Bootstrap::hasPassword( $password );
$arrayData["USR_FIRSTNAME"] = $firstName;
$arrayData["USR_LASTNAME"] = $lastName;
$arrayData["USR_EMAIL"] = $email;
@@ -1380,7 +1380,7 @@ class wsBase
}
if (! empty( $password )) {
$arrayData["USR_PASSWORD"] = md5( $password );
$arrayData["USR_PASSWORD"] = Bootstrap::hasPassword( $password );
}
//Update user

View File

@@ -1624,5 +1624,12 @@ class workspaceTools
}
}
public function changeHashPassword ($workspace,$response) {
G::LoadClass("patch");
$this->initPropel( true );
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->executeTriggers ( PM_HASH_PASSWORD , $response );
}
}

View File

@@ -306,7 +306,7 @@ class Installer extends Controller
$info->pathLogFile->result = file_exists( $_REQUEST['pathLogFile'] );
if ($info->pathLogFile->result) {
$info->pathLogFile->message = G::LoadTranslation('ID_INSTALLATION_LOG');
$info->pathLogFile->message = G::LoadTranslation('ID_INSTALLATION_FILE_LOG');
}
if ($info->success) {

View File

@@ -379,7 +379,7 @@ class Main extends Controller
$newPass = G::generate_password();
$aData['USR_UID'] = $userData['USR_UID'];
$aData['USR_PASSWORD'] = md5( $newPass );
$aData['USR_PASSWORD'] = Bootstrap::hasPassword( $newPass );
$rbacUser->update( $aData );
$user->update( $aData );

View File

@@ -109,6 +109,7 @@ require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enter
$enterprise = new enterprisePlugin('enterprise');
if (!file_exists(PATH_DATA_SITE . "plugin.singleton")) {
$enterprise->install();
$enterprise->enable();
}
$enterprise->setup();

View File

@@ -105,6 +105,12 @@ class enterprisePlugin extends PMPlugin
public function install()
{
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginDetail = $pluginRegistry->getPluginDetails("enterprise.php");
$pluginRegistry->enablePlugin($pluginDetail->sNamespace);
file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
}
public function uninstall()
@@ -113,25 +119,16 @@ class enterprisePlugin extends PMPlugin
public function setup()
{
$urlPart = substr(SYS_SKIN, 0, 2) == 'ux' && SYS_SKIN != 'uxs' ? 'main/login' : 'login/login';
$this->registerMenu("setup", "menuEnterprise.php");
//including the file inside the enterprise folder
////including the file inside the enterprise folder
require_once PATH_CORE . 'classes' . PATH_SEP . 'class.pmLicenseManager.php';
$this->registerTrigger(PM_LOGIN, "enterpriseSystemUpdate");
$licenseManager = &pmLicenseManager::getSingleton();
$oHeadPublisher = &headPublisher::getSingleton();
$this->registerTrigger(PM_HASH_PASSWORD, 'setHashPassword');
}
public function enable()
{
$this->setConfiguration();
$pluginRegistry = &PMPluginRegistry::getSingleton();
file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
require_once (PATH_CORE . 'classes/model/AddonsStore.php');
AddonsStore::checkLicenseStore();
@@ -348,6 +345,25 @@ class enterprisePlugin extends PMPlugin
fclose($file);
}
}
public function hashPassword ($pass, $previous=false)
{
G::LoadClass( "configuration" );
$config= new Configurations();
$typeEncrypt = $config->getConfiguration('ENTERPRISE_SETTING_ENCRYPT', '');
$encrypt = 'md5';
if ($typeEncrypt != null) {
if (isset($typeEncrypt['current']) && $typeEncrypt['current'] != '') {
$encrypt = $typeEncrypt['current'];
}
if ($previous && isset($typeEncrypt['previous']) && $typeEncrypt['previous'] != '' ) {
$encrypt = $typeEncrypt['previous'];
}
}
eval("\$var = hash('" . $encrypt . "', '" . $pass . "');");
return $var;
}
}
$oPluginRegistry = &PMPluginRegistry::getSingleton();

View File

@@ -40,6 +40,14 @@ try {
$pwd = trim($frm['USR_PASSWORD']);
}
require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php';
$enterprise = new enterprisePlugin('enterprise');
if (!file_exists(PATH_DATA_SITE . "plugin.singleton")) {
$enterprise->enable();
}
$enterprise->setup();
$uid = $RBAC->VerifyLogin($usr , $pwd);
$RBAC->cleanSessionFiles(72); //cleaning session files older than 72 hours

View File

@@ -5,7 +5,7 @@ $aUser = $oUser->load($_SESSION['USER_LOGGED']);
global $RBAC;
$aData['USR_UID'] = $aUser['USR_UID'];
$aData['USR_USERNAME'] = $aUser['USR_USERNAME'];
$aData['USR_PASSWORD'] = md5($_POST['form']['USR_PASSWORD']);
$aData['USR_PASSWORD'] = Bootstrap::hasPassword($_POST['form']['USR_PASSWORD']);
$aData['USR_FIRSTNAME'] = $aUser['USR_FIRSTNAME'];
$aData['USR_LASTNAME'] = $aUser['USR_LASTNAME'];
$aData['USR_EMAIL'] = $aUser['USR_EMAIL'];

View File

@@ -22,7 +22,7 @@ if ($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL'
$newPass = G::generate_password();
$aData['USR_UID'] = $userData['USR_UID'];
$aData['USR_PASSWORD'] = md5($newPass);
$aData['USR_PASSWORD'] = Bootstrap::hasPassword($newPass);
/* **Save after sending the mail
$rbacUser->update($aData);
$user->update($aData);

View File

@@ -50,7 +50,7 @@ try {
$_POST['form']['USR_NEW_PASS'] = '';
}
if ($_POST['form']['USR_NEW_PASS'] != '') {
$_POST['form']['USR_PASSWORD'] = md5( $_POST['form']['USR_NEW_PASS'] );
$_POST['form']['USR_PASSWORD'] = Bootstrap::hasPassword( $_POST['form']['USR_NEW_PASS'] );
}
if (! isset( $_POST['form']['USR_CITY'] )) {
$_POST['form']['USR_CITY'] = '';

View File

@@ -130,7 +130,7 @@ switch ($_POST['action']) {
$form['USR_NEW_PASS'] = '';
}
if ($form['USR_NEW_PASS'] != '') {
$form['USR_PASSWORD'] = md5($form['USR_NEW_PASS']);
$form['USR_PASSWORD'] = Bootstrap::hasPassword($form['USR_NEW_PASS']);
}
if (!isset($form['USR_CITY'])) {
$form['USR_CITY'] = '';
@@ -214,7 +214,7 @@ switch ($_POST['action']) {
*/
require_once 'classes/model/UsersProperties.php';
$oUserProperty = new UsersProperties();
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($aData['USR_UID'], array('USR_PASSWORD_HISTORY' => serialize(array(md5($aData['USR_PASSWORD'])))));
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($aData['USR_UID'], array('USR_PASSWORD_HISTORY' => serialize(array(Bootstrap::hasPassword($aData['USR_PASSWORD'])))));
$aUserProperty['USR_LOGGED_NEXT_TIME'] = $form['USR_LOGGED_NEXT_TIME'];
$oUserProperty->update($aUserProperty);
} else {

View File

@@ -63,7 +63,7 @@ try {
$form['USR_NEW_PASS'] = '';
}
if ($form['USR_NEW_PASS'] != '') {
$form['USR_PASSWORD'] = md5( $form['USR_NEW_PASS'] );
$form['USR_PASSWORD'] = Bootstrap::hasPassword( $form['USR_NEW_PASS'] );
}
if (! isset( $form['USR_CITY'] )) {
$form['USR_CITY'] = '';

View File

@@ -430,7 +430,7 @@ Ext.onReady(function(){
},
{
xtype: 'textfield',
fieldLabel: '<span id="pathLogFileSpan"></span> ' + _('ID_INSTALLATION_LOG'),
fieldLabel: '<span id="pathLogFileSpan"></span> ' + _('ID_INSTALLATION_FILE_LOG'),
id: 'pathLogFile',
width: 430,
value: path_shared + 'log' + path_sep + 'install.log',