mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-21 06:01:06 +01:00
no need to write empty usernames, store empty passwords without encrypting them as "", because mcrypt will give a warning and returning just false otherwise
This commit is contained in:
parent
26abe50b8c
commit
087f457da0
@ -233,12 +233,19 @@ class emailadmin_credentials
|
|||||||
//error_log(__METHOD__."($acc_id, '$username', \$password, $type, $account_id, ".array2string($cred_id).") not storing session credentials!");
|
//error_log(__METHOD__."($acc_id, '$username', \$password, $type, $account_id, ".array2string($cred_id).") not storing session credentials!");
|
||||||
return; // do NOT store credentials from session of current user!
|
return; // do NOT store credentials from session of current user!
|
||||||
}
|
}
|
||||||
|
// no need to write empty usernames, but delete existing row
|
||||||
|
if ((string)$username === '')
|
||||||
|
{
|
||||||
|
if ($cred_id) self::$db->delete(self::TABLE, array('cred_id' => $cred_id), __LINE__, __FILE__, self::APP);
|
||||||
|
return; // nothing to save
|
||||||
|
}
|
||||||
$pw_enc = self::CLEARTEXT;
|
$pw_enc = self::CLEARTEXT;
|
||||||
$data = array(
|
$data = array(
|
||||||
'acc_id' => $acc_id,
|
'acc_id' => $acc_id,
|
||||||
'account_id' => $account_id,
|
'account_id' => $account_id,
|
||||||
'cred_username' => $username,
|
'cred_username' => $username,
|
||||||
'cred_password' => self::encrypt($password, $account_id, $pw_enc, $mcrypt),
|
'cred_password' => (string)$password === '' ? '' :
|
||||||
|
self::encrypt($password, $account_id, $pw_enc, $mcrypt),
|
||||||
'cred_type' => $type,
|
'cred_type' => $type,
|
||||||
'cred_pw_enc' => $pw_enc,
|
'cred_pw_enc' => $pw_enc,
|
||||||
);
|
);
|
||||||
@ -344,7 +351,7 @@ class emailadmin_credentials
|
|||||||
{
|
{
|
||||||
throw new egw_exception_wrong_parameter("Password encryption type $row[cred_pw_enc] NOT available for mail account #$row[acc_id] and user #$row[account_id]/$row[cred_username]!");
|
throw new egw_exception_wrong_parameter("Password encryption type $row[cred_pw_enc] NOT available for mail account #$row[acc_id] and user #$row[account_id]/$row[cred_username]!");
|
||||||
}
|
}
|
||||||
return (!empty($row['cred_password'])?trim(mdecrypt_generic($mcrypt, base64_decode($row['cred_password']))):'');
|
return !empty($row['cred_password']) ? trim(mdecrypt_generic($mcrypt, base64_decode($row['cred_password']))) : '';
|
||||||
}
|
}
|
||||||
throw new egw_exception_wrong_parameter("Unknow password encryption type $row[cred_pw_enc]!");
|
throw new egw_exception_wrong_parameter("Unknow password encryption type $row[cred_pw_enc]!");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user