move user creation to bcrypt

pull/2616/head
Pliable Pixels 2019-05-12 13:01:29 -04:00
parent 91dd6630b5
commit d7dbaf52d4
1 changed files with 25 additions and 4 deletions

View File

@ -28,8 +28,18 @@ if ( $action == 'user' ) {
$types = array();
$changes = getFormChanges($dbUser, $_REQUEST['newUser'], $types);
if ( $_REQUEST['newUser']['Password'] )
$changes['Password'] = 'Password = password('.dbEscape($_REQUEST['newUser']['Password']).')';
if (function_exists ('password_hash')) {
$pass_hash = '"'.password_hash($pass, PASSWORD_BCRYPT).'"';
} else {
$pass_hash = ' PASSWORD('.dbEscape($_REQUEST['newUser']['Password']).') ';
ZM\Info ('Cannot use bcrypt as you are using PHP < 5.5');
}
if ( $_REQUEST['newUser']['Password'] ) {
$changes['Password'] = 'Password = '.$pass_hash;
ZM\Info ("PASS CMD=".$changes['Password']);
}
else
unset($changes['Password']);
@ -53,8 +63,19 @@ if ( $action == 'user' ) {
$types = array();
$changes = getFormChanges($dbUser, $_REQUEST['newUser'], $types);
if ( !empty($_REQUEST['newUser']['Password']) )
$changes['Password'] = 'Password = password('.dbEscape($_REQUEST['newUser']['Password']).')';
if (function_exists ('password_hash')) {
$pass_hash = '"'.password_hash($pass, PASSWORD_BCRYPT).'"';
} else {
$pass_hash = ' PASSWORD('.dbEscape($_REQUEST['newUser']['Password']).') ';
ZM\Info ('Cannot use bcrypt as you are using PHP < 5.5');
}
if ( !empty($_REQUEST['newUser']['Password']) ) {
ZM\Info ("PASS CMD=".$changes['Password']);
$changes['Password'] = 'Password = '.$pass_hash;
}
else
unset($changes['Password']);
if ( count($changes) ) {