BUG-15561 Cambiar el algoritmo o metodo de cifrado... SOLVED
- It don't have the functionality. - A function was add in class bootstrap hasPassword. - a function was add in class enterprise.
This commit is contained in:
@@ -2859,5 +2859,33 @@ 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) {
|
||||
|
||||
}
|
||||
error_log('hasPassword bootstrap ' . $passEncrypt);
|
||||
|
||||
return $passEncrypt;
|
||||
}
|
||||
|
||||
public function verifyHashPassword ($pass, $userPass)
|
||||
{
|
||||
//$verify = Bootstrap::hasPassword($pass);
|
||||
error_log('contraseña config...');
|
||||
if (Bootstrap::hasPassword($pass) == $userPass) {
|
||||
return true;
|
||||
}
|
||||
error_log('contraseña anterior...');
|
||||
if (Bootstrap::hasPassword($pass, true) == $userPass) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -80,10 +80,9 @@ 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) {
|
||||
error_log('contraseña bbdd... '. $aFields['USR_PASSWORD']);
|
||||
if( Bootstrap::verifyHashPassword($sPassword, $aFields['USR_PASSWORD']) ) {
|
||||
if ($aFields['USR_DUE_DATE'] < date('Y-m-d')) {
|
||||
return -4;
|
||||
}
|
||||
|
||||
@@ -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,84 +14,85 @@ 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
|
||||
*/
|
||||
const CLASS_NAME = 'classes.model.map.RbacUsersMapBuilder';
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'classes.model.map.RbacUsersMapBuilder';
|
||||
|
||||
/**
|
||||
* The database map.
|
||||
*/
|
||||
private $dbMap;
|
||||
/**
|
||||
* The database map.
|
||||
*/
|
||||
private $dbMap;
|
||||
|
||||
/**
|
||||
* Tells us if this DatabaseMapBuilder is built so that we
|
||||
* don't have to re-build it every time.
|
||||
*
|
||||
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
|
||||
*/
|
||||
public function isBuilt()
|
||||
{
|
||||
return ($this->dbMap !== null);
|
||||
}
|
||||
/**
|
||||
* Tells us if this DatabaseMapBuilder is built so that we
|
||||
* don't have to re-build it every time.
|
||||
*
|
||||
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
|
||||
*/
|
||||
public function isBuilt()
|
||||
{
|
||||
return ($this->dbMap !== null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the databasemap this map builder built.
|
||||
*
|
||||
* @return the databasemap
|
||||
*/
|
||||
public function getDatabaseMap()
|
||||
{
|
||||
return $this->dbMap;
|
||||
}
|
||||
/**
|
||||
* Gets the databasemap this map builder built.
|
||||
*
|
||||
* @return the databasemap
|
||||
*/
|
||||
public function getDatabaseMap()
|
||||
{
|
||||
return $this->dbMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* The doBuild() method builds the DatabaseMap
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function doBuild()
|
||||
{
|
||||
$this->dbMap = Propel::getDatabaseMap('rbac');
|
||||
/**
|
||||
* The doBuild() method builds the DatabaseMap
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function doBuild()
|
||||
{
|
||||
$this->dbMap = Propel::getDatabaseMap('rbac');
|
||||
|
||||
$tMap = $this->dbMap->addTable('RBAC_USERS');
|
||||
$tMap->setPhpName('RbacUsers');
|
||||
$tMap = $this->dbMap->addTable('RBAC_USERS');
|
||||
$tMap->setPhpName('RbacUsers');
|
||||
|
||||
$tMap->setUseIdGenerator(false);
|
||||
$tMap->setUseIdGenerator(false);
|
||||
|
||||
$tMap->addPrimaryKey('USR_UID', 'UsrUid', 'string', CreoleTypes::VARCHAR, true, 32);
|
||||
$tMap->addPrimaryKey('USR_UID', 'UsrUid', 'string', CreoleTypes::VARCHAR, true, 32);
|
||||
|
||||
$tMap->addColumn('USR_USERNAME', 'UsrUsername', 'string', CreoleTypes::VARCHAR, true, 100);
|
||||
$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);
|
||||
$tMap->addColumn('USR_FIRSTNAME', 'UsrFirstname', 'string', CreoleTypes::VARCHAR, true, 50);
|
||||
|
||||
$tMap->addColumn('USR_LASTNAME', 'UsrLastname', 'string', CreoleTypes::VARCHAR, true, 50);
|
||||
$tMap->addColumn('USR_LASTNAME', 'UsrLastname', 'string', CreoleTypes::VARCHAR, true, 50);
|
||||
|
||||
$tMap->addColumn('USR_EMAIL', 'UsrEmail', 'string', CreoleTypes::VARCHAR, true, 100);
|
||||
$tMap->addColumn('USR_EMAIL', 'UsrEmail', 'string', CreoleTypes::VARCHAR, true, 100);
|
||||
|
||||
$tMap->addColumn('USR_DUE_DATE', 'UsrDueDate', 'int', CreoleTypes::DATE, true, null);
|
||||
$tMap->addColumn('USR_DUE_DATE', 'UsrDueDate', 'int', CreoleTypes::DATE, true, null);
|
||||
|
||||
$tMap->addColumn('USR_CREATE_DATE', 'UsrCreateDate', 'int', CreoleTypes::TIMESTAMP, false, null);
|
||||
$tMap->addColumn('USR_CREATE_DATE', 'UsrCreateDate', 'int', CreoleTypes::TIMESTAMP, false, null);
|
||||
|
||||
$tMap->addColumn('USR_UPDATE_DATE', 'UsrUpdateDate', 'int', CreoleTypes::TIMESTAMP, false, null);
|
||||
$tMap->addColumn('USR_UPDATE_DATE', 'UsrUpdateDate', 'int', CreoleTypes::TIMESTAMP, false, null);
|
||||
|
||||
$tMap->addColumn('USR_STATUS', 'UsrStatus', 'int', CreoleTypes::INTEGER, true, null);
|
||||
$tMap->addColumn('USR_STATUS', 'UsrStatus', 'int', CreoleTypes::INTEGER, true, null);
|
||||
|
||||
$tMap->addColumn('USR_AUTH_TYPE', 'UsrAuthType', 'string', CreoleTypes::VARCHAR, true, 32);
|
||||
$tMap->addColumn('USR_AUTH_TYPE', 'UsrAuthType', 'string', CreoleTypes::VARCHAR, true, 32);
|
||||
|
||||
$tMap->addColumn('UID_AUTH_SOURCE', 'UidAuthSource', 'string', CreoleTypes::VARCHAR, true, 32);
|
||||
$tMap->addColumn('UID_AUTH_SOURCE', 'UidAuthSource', 'string', CreoleTypes::VARCHAR, true, 32);
|
||||
|
||||
$tMap->addColumn('USR_AUTH_USER_DN', 'UsrAuthUserDn', 'string', CreoleTypes::VARCHAR, true, 255);
|
||||
$tMap->addColumn('USR_AUTH_USER_DN', 'UsrAuthUserDn', 'string', CreoleTypes::VARCHAR, true, 255);
|
||||
|
||||
$tMap->addColumn('USR_AUTH_SUPERVISOR_DN', 'UsrAuthSupervisorDn', 'string', CreoleTypes::VARCHAR, true, 255);
|
||||
$tMap->addColumn('USR_AUTH_SUPERVISOR_DN', 'UsrAuthSupervisorDn', 'string', CreoleTypes::VARCHAR, true, 255);
|
||||
|
||||
} // doBuild()
|
||||
} // doBuild()
|
||||
|
||||
} // RbacUsersMapBuilder
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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="" />
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1566,5 +1566,12 @@ class workspaceTools
|
||||
}
|
||||
}
|
||||
|
||||
public function changeHashPassword ($workspace,$response) {
|
||||
G::LoadClass("patch");
|
||||
$this->initPropel( true );
|
||||
|
||||
$oPluginRegistry =& PMPluginRegistry::getSingleton();
|
||||
$oPluginRegistry->executeTriggers ( PM_HASH_PASSWORD , $response );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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,28 @@ class enterprisePlugin extends PMPlugin
|
||||
fclose($file);
|
||||
}
|
||||
}
|
||||
|
||||
public function hashPassword ($pass, $previous=false)
|
||||
{
|
||||
G::LoadClass( "configuration" );
|
||||
$config= new Configurations();
|
||||
$typeEncrypt = $config->getConfiguration('ENTERPRISE_SETTING_ENCRYPT', '');
|
||||
//$typeEncrypt = ($typeEncrypt == null) ? 'md5' : isset($typeEncrypt['current']) ? $typeEncrypt['current'] : 'md5';
|
||||
$encrypt = 'md5';
|
||||
if ($typeEncrypt != null) {
|
||||
if (isset($typeEncrypt['current']) && $typeEncrypt['current'] != '') {
|
||||
$encrypt = $typeEncrypt['current'];
|
||||
error_log('hashPassword bootstrap ' . $encrypt);
|
||||
}
|
||||
if ($previous && isset($typeEncrypt['previous']) && $typeEncrypt['previous'] != '' ) {
|
||||
$encrypt = $typeEncrypt['previous'];
|
||||
error_log('hashPassword bootstrap ' . $encrypt);
|
||||
}
|
||||
}
|
||||
eval("\$var = hash('" . $encrypt . "', '" . $pass . "');");
|
||||
|
||||
return $var;
|
||||
}
|
||||
}
|
||||
|
||||
$oPluginRegistry = &PMPluginRegistry::getSingleton();
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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'];
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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'] = '';
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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'] = '';
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user