[DEFAULTS] Add password hashing algorithm default settings

This commit is contained in:
Hugo Sales 2020-07-22 11:48:32 +00:00 committed by Hugo Sales
parent 0eba267a73
commit 59fcd042e9
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -65,9 +65,12 @@ abstract class DefaultSettings
'x_static_delivery' => null, 'x_static_delivery' => null,
'defaults_modified' => time(), 'defaults_modified' => time(),
], ],
'security' => ['hash_algos' => ['sha1', 'sha256', 'sha512']], // set to null for anything that hash_hmac() can handle (and is in hash_algos()) 'security' => [
'db' => ['mirror' => null], // TODO implement 'algorithm' => 'bcrypt', // bcrypt, argon2i or argon2id
'cache' => [ 'options' => ['cost' => 12], // for argon, ['memory_cost' => PASSWORD_ARGON2_DEFAULT_MEMORY_COST, 'time_cost' => PASSWORD_ARGON2_DEFAULT_TIME_COST, 'threads' => PASSWORD_ARGON2_DEFAULT_THREADS]
],
'db' => ['mirror' => null], // TODO implement
'cache' => [
'notice_max_count' => 128, 'notice_max_count' => 128,
], ],
'avatar' => [ 'avatar' => [
@ -244,12 +247,20 @@ abstract class DefaultSettings
'discovery' => ['CORS' => false], // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.) 'discovery' => ['CORS' => false], // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
]; ];
$modified = Common::config('site', 'defaults_modified'); if (!DB::getConnection()->getSchemaManager()->tablesExist(['config'])) {
if ($modified > filemtime(__FILE__)) {
// Don't bother modifying the table if this file is older
return; return;
} }
try {
$modified = Common::config('site', 'defaults_modified');
if ($modified > filemtime(__FILE__)) {
// Don't bother modifying the table if this file is older
return;
}
} catch (\Exception $e) {
// It seems the table wasn't initialized yet, carry on
}
self::loadDefaults($_ENV['APP_ENV'] == 'prod'); self::loadDefaults($_ENV['APP_ENV'] == 'prod');
} }