diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index f75bb21eae9..22b32e14f51 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -108,11 +108,11 @@ function dolGetRandomBytes($length) /** * Encode a string with a symetric encryption. Used to encrypt sensitive data into database. - * Note: If a backup is restored onto another instance with a different $dolibarr_main_instance_unique_id, then decoded value will differ. + * Note: If a backup is restored onto another instance with a different $conf->file->instance_unique_id, then decoded value will differ. * This function is called for example by dol_set_const() when saving a sensible data into database configuration table llx_const. * * @param string $chain string to encode - * @param string $key If '', we use $dolibarr_main_instance_unique_id + * @param string $key If '', we use $conf->file->instance_unique_id * @param string $ciphering Default ciphering algorithm * @param string $forceseed To force the seed * @return string encoded string @@ -120,7 +120,7 @@ function dolGetRandomBytes($length) */ function dolEncrypt($chain, $key = '', $ciphering = 'AES-256-CTR', $forceseed = '') { - global $dolibarr_main_instance_unique_id; + global $conf; global $dolibarr_disable_dolcrypt_for_debug; if ($chain === '' || is_null($chain)) { @@ -134,7 +134,7 @@ function dolEncrypt($chain, $key = '', $ciphering = 'AES-256-CTR', $forceseed = } if (empty($key)) { - $key = $dolibarr_main_instance_unique_id; + $key = $conf->file->instance_unique_id; } if (empty($ciphering)) { $ciphering = 'AES-256-CTR'; @@ -165,23 +165,23 @@ function dolEncrypt($chain, $key = '', $ciphering = 'AES-256-CTR', $forceseed = /** * Decode a string with a symetric encryption. Used to decrypt sensitive data saved into database. - * Note: If a backup is restored onto another instance with a different $dolibarr_main_instance_unique_id, then decoded value will differ. + * Note: If a backup is restored onto another instance with a different $conf->file->instance_unique_id, then decoded value will differ. * * @param string $chain string to encode - * @param string $key If '', we use $dolibarr_main_instance_unique_id + * @param string $key If '', we use $conf->file->instance_unique_id * @return string encoded string * @see dolEncrypt(), dol_hash() */ function dolDecrypt($chain, $key = '') { - global $dolibarr_main_instance_unique_id; + global $conf; if ($chain === '' || is_null($chain)) { return ''; } if (empty($key)) { - $key = $dolibarr_main_instance_unique_id; + $key = $conf->file->instance_unique_id; } $reg = array(); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 9d70d846050..ced127036b7 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2451,11 +2451,11 @@ class User extends CommonObject dol_syslog(get_class($this)."::send_password changelater is off, url=".$url); } else { - global $dolibarr_main_instance_unique_id; + global $conf; - //print $password.'-'.$this->id.'-'.$dolibarr_main_instance_unique_id; + //print $password.'-'.$this->id.'-'.$conf->file->instance_unique_id; $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword'; - $url .= '&username='.urlencode($this->login)."&passworduidhash=".urlencode(dol_hash($password.'-'.$this->id.'-'.$dolibarr_main_instance_unique_id)); + $url .= '&username='.urlencode($this->login)."&passworduidhash=".urlencode(dol_hash($password.'-'.$this->id.'-'.$conf->file->instance_unique_id)); if (isModEnabled('multicompany')) { $url .= '&entity='.(!empty($this->entity) ? $this->entity : 1); } @@ -3894,10 +3894,10 @@ class User extends CommonObject */ public function getOnlineVirtualCardUrl($mode = '', $typeofurl = 'external') { - global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root; + global $dolibarr_main_url_root; global $conf; - $encodedsecurekey = dol_hash($dolibarr_main_instance_unique_id.'uservirtualcard'.$this->id.'-'.$this->login, 'md5'); + $encodedsecurekey = dol_hash($conf->file->instance_unique_id.'uservirtualcard'.$this->id.'-'.$this->login, 'md5'); if (isModEnabled('multicompany')) { $entity_qr = '&entity='.((int) $conf->entity); } else { diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 3f2d9e4059f..c7a132feee2 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -94,10 +94,10 @@ if (empty($reshook)) { if ($result < 0) { $message = '