]> git.mxchange.org Git - friendica.git/commitdiff
Improve parent user password check in Module/Settings/Delegation
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 10 Oct 2019 08:10:29 +0000 (04:10 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Thu, 10 Oct 2019 08:10:29 +0000 (04:10 -0400)
src/Module/Settings/Delegation.php

index 4e077b9be65f48d32fcf9c0b749cf269282d4993..5cb2f399ca46c84577e765bbc7e69f53ee33e922 100644 (file)
@@ -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 {