mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Can still connect if option do not save clear password is reversed.
This commit is contained in:
parent
3ad5d6b566
commit
03010ac770
|
|
@ -61,9 +61,11 @@ if ($_GET["action"] == 'activate_encrypt')
|
|||
$db->begin();
|
||||
|
||||
dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1");
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " SET u.pass = NULL AND u.pass_crypted = MD5(u.pass)";
|
||||
$sql.= " SET u.pass_crypted = MD5(u.pass), u.pass = NULL";
|
||||
$sql.= " WHERE u.pass IS NOT NULL AND LENGTH(u.pass) < 32"; // Not a MD5 value
|
||||
$sql.= " AND MD5(u.pass) IS NOT NULL";
|
||||
|
||||
//print $sql;
|
||||
$result = $db->query($sql);
|
||||
|
|
@ -75,6 +77,7 @@ if ($_GET["action"] == 'activate_encrypt')
|
|||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
dolibarr_print_error($db,'');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,23 +63,33 @@ function check_user_password_dolibarr($usertotest,$passwordtotest)
|
|||
|
||||
// Check crypted password
|
||||
$cryptType='';
|
||||
if ($conf->global->DATABASE_PWD_ENCRYPTED) $cryptType='md5';
|
||||
if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) $cryptType=$conf->global->DATABASE_PWD_ENCRYPTED;
|
||||
// By default, we used MD5
|
||||
if (! in_array($cryptType,array('md5'))) $cryptType='md5';
|
||||
// Check crypted password according to crypt algorithm
|
||||
if ($cryptType == 'md5')
|
||||
{
|
||||
if (md5($passtyped) == $passcrypted) $passok=true;
|
||||
if (md5($passtyped) == $passcrypted)
|
||||
{
|
||||
$passok=true;
|
||||
dolibarr_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - ".$cryptType." of pass is ok");
|
||||
}
|
||||
}
|
||||
|
||||
// For compatibility with old versions
|
||||
if (! $passok)
|
||||
{
|
||||
if ((! $passcrypted || $passtyped)
|
||||
&& ($passtyped == $passclear)) $passok=true;
|
||||
&& ($passtyped == $passclear))
|
||||
{
|
||||
$passok=true;
|
||||
dolibarr_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - found pass in database");
|
||||
}
|
||||
}
|
||||
|
||||
// Password ok ?
|
||||
if ($passok)
|
||||
{
|
||||
dolibarr_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok");
|
||||
$login=$_POST["username"];
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/index.php
|
||||
\brief Page accueil par defaut
|
||||
\version $Id$
|
||||
* \file htdocs/index.php
|
||||
* \brief Page accueil par defaut
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user