From cc0cf2b8ce8c758293460a93806e1b3007ad5d12 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 10 Oct 2019 04:10:29 -0400 Subject: [PATCH] Improve parent user password check in Module/Settings/Delegation --- src/Module/Settings/Delegation.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Module/Settings/Delegation.php b/src/Module/Settings/Delegation.php index 4e077b9be6..5cb2f399ca 100644 --- a/src/Module/Settings/Delegation.php +++ b/src/Module/Settings/Delegation.php @@ -29,17 +29,11 @@ class Delegation extends BaseSettingsModule $parent_password = $_POST['parent_password'] ?? ''; if ($parent_uid != 0) { - $user = DBA::selectFirst('user', ['nickname'], ['uid' => $parent_uid]); - if (!DBA::isResult($user)) { - notice(L10n::t('Parent user not found.')); - return; - } - try { - User::getIdFromPasswordAuthentication($user['nickname'], $parent_password); + User::getIdFromPasswordAuthentication($parent_uid, $parent_password); info(L10n::t('Delegation successfully granted.')); - } catch (\Throwable $ex) { - notice(L10n::t('Parent user password doesn\'t match.')); + } catch (\Exception $ex) { + notice(L10n::t('Parent user not found, unavailable or password doesn\'t match.')); return; } } else { -- 2.39.5