Improve parent user password check in Module/Settings/Delegation
This commit is contained in:
parent
616edd0600
commit
cc0cf2b8ce
1 changed files with 3 additions and 9 deletions
|
@ -29,17 +29,11 @@ class Delegation extends BaseSettingsModule
|
||||||
$parent_password = $_POST['parent_password'] ?? '';
|
$parent_password = $_POST['parent_password'] ?? '';
|
||||||
|
|
||||||
if ($parent_uid != 0) {
|
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 {
|
try {
|
||||||
User::getIdFromPasswordAuthentication($user['nickname'], $parent_password);
|
User::getIdFromPasswordAuthentication($parent_uid, $parent_password);
|
||||||
info(L10n::t('Delegation successfully granted.'));
|
info(L10n::t('Delegation successfully granted.'));
|
||||||
} catch (\Throwable $ex) {
|
} catch (\Exception $ex) {
|
||||||
notice(L10n::t('Parent user password doesn\'t match.'));
|
notice(L10n::t('Parent user not found, unavailable or password doesn\'t match.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue