|
@@ -25,7 +25,7 @@ function checkPasswordFormat(string $password): void {
|
|
|
}
|
|
|
|
|
|
function hashUsername(string $username): string {
|
|
|
- return base64_encode(sodium_crypto_pwhash(32, $username, hex2bin(query('select', 'params', ['name' => 'username_salt'], 'value')[0]), 2**10, 2**14, SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13));
|
|
|
+ return base64_encode(sodium_crypto_pwhash(32, $username, hex2bin(query('select', 'params', ['name' => 'username_salt'], ['value'])[0]), 2**10, 2**14, SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13));
|
|
|
}
|
|
|
|
|
|
function hashPassword(string $password): string {
|
|
@@ -33,15 +33,15 @@ function hashPassword(string $password): string {
|
|
|
}
|
|
|
|
|
|
function usernameExists(string $username): bool {
|
|
|
- return isset(query('select', 'users', ['username' => $username], 'id')[0]);
|
|
|
+ return isset(query('select', 'users', ['username' => $username], ['id'])[0]);
|
|
|
}
|
|
|
|
|
|
function checkPassword(string $id, string $password): bool {
|
|
|
- return password_verify($password, query('select', 'users', ['id' => $id], 'password')[0]);
|
|
|
+ return password_verify($password, query('select', 'users', ['id' => $id], ['password'])[0]);
|
|
|
}
|
|
|
|
|
|
function outdatedPasswordHash(string $id): bool {
|
|
|
- return password_needs_rehash(query('select', 'users', ['id' => $id], 'password')[0], ALGO_PASSWORD, OPTIONS_PASSWORD);
|
|
|
+ return password_needs_rehash(query('select', 'users', ['id' => $id], ['password'])[0], ALGO_PASSWORD, OPTIONS_PASSWORD);
|
|
|
}
|
|
|
|
|
|
function changePassword(string $id, string $password): void {
|
|
@@ -88,18 +88,18 @@ function setupDisplayUsername(string $display_username): void {
|
|
|
}
|
|
|
|
|
|
function authDeleteUser(string $user_id): void {
|
|
|
- $user_services = explode(',', query('select', 'users', ['id' => $user_id], 'services')[0]);
|
|
|
+ $user_services = explode(',', query('select', 'users', ['id' => $user_id], ['services'])[0]);
|
|
|
|
|
|
foreach (SERVICES_USER as $service)
|
|
|
if (in_array($service, $user_services, true) AND CONF['common']['services'][$service] !== 'enabled')
|
|
|
output(503, sprintf(_('Your account can\'t be deleted because the %s service is currently unavailable.'), '<em>' . PAGES[$service]['index']['title'] . '</em>'));
|
|
|
|
|
|
if (in_array('reg', $user_services, true))
|
|
|
- foreach (query('select', 'registry', ['username' => $user_id], 'domain') as $domain)
|
|
|
+ foreach (query('select', 'registry', ['username' => $user_id], ['domain']) as $domain)
|
|
|
regDeleteDomain($domain, $user_id);
|
|
|
|
|
|
if (in_array('ns', $user_services, true))
|
|
|
- foreach (query('select', 'zones', ['username' => $user_id], 'zone') as $zone)
|
|
|
+ foreach (query('select', 'zones', ['username' => $user_id], ['zone']) as $zone)
|
|
|
nsDeleteZone($zone, $user_id);
|
|
|
|
|
|
if (in_array('ht', $user_services, true)) {
|
|
@@ -178,8 +178,8 @@ function rateLimitAccount(int $requestedTokens): int {
|
|
|
|
|
|
function rateLimitInstance(int $requestedTokens): void {
|
|
|
// Get
|
|
|
- $tokens = query('select', 'params', ['name' => 'instance_bucket_tokens'], 'value')[0];
|
|
|
- $bucketLastUpdate = query('select', 'params', ['name' => 'instance_bucket_last_update'], 'value')[0];
|
|
|
+ $tokens = query('select', 'params', ['name' => 'instance_bucket_tokens'], ['value'])[0];
|
|
|
+ $bucketLastUpdate = query('select', 'params', ['name' => 'instance_bucket_last_update'], ['value'])[0];
|
|
|
|
|
|
// Compute
|
|
|
$tokens = min(86400, $tokens + (time() - $bucketLastUpdate));
|