[TikiWiki-commits] [Git][tikiwiki/tiki][27.x] [FIX] Define missing bruteForceProperties closure in tiki-change_password.php
"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a8ac376263ba_38a2edf1047157@gitlab-sidekiq-low-urgency-cpu-bound-v2-6dbfb999b6-fgbth.mail> |
ushindi bienvenu pushed to branch 27.x at Tiki Wiki CMS Groupware / Tiki Commits: 3bf3f1e0 by ushindi bienvenu at 2026-08-23T09:55:00+00:00 [FIX] Define missing bruteForceProperties closure in tiki-change_password.php --- * [FIX] Define missing bruteForceProperties closure in tiki-change_password.php See merge request tikiwiki/tiki!11033 (cherry picked from commit b54337bb636328ddde2e35b19d3cb01460a5b70b) 62d4ef6f [FIX] Define missing bruteForceProperties closure in tiki-change_password.php Co-authored-by: Espoir Baraka <[email protected]> - - - - - 1 changed file: - tiki-change_password.php Changes: ===================================== tiki-change_password.php ===================================== @@ -38,6 +38,9 @@ if (! isset($_REQUEST["oldpass"])) { $user = $_REQUEST["user"]; $secure_token = $_REQUEST["token"] ?? ''; +$bruteForceProperties = function () use ($tikilib) { + return ['ip' => $tikilib->get_ip_address()]; +}; $pass_confirm = $userlib->getOne('select `pass_confirm` from `users_users` where binary `login`=?', [$user]); $must_change_password = ($pass_confirm === 0 || $pass_confirm === null); @@ -84,14 +87,14 @@ $smarty->assign('secure_token', $secure_token); if (isset($_REQUEST["change"]) && $access->checkCsrf()) { if (($prefs['bruteforce_protection'] ?? 'n') === 'y') { - if (! $bruteForce->isOperationAllowed('change_password', ['ip' => $tikilib->get_ip_address()])) { - $nextAllowedTime = $bruteForce->getNextAllowedTime('change_password', ['ip' => $tikilib->get_ip_address()]); - $waitTime = $nextAllowedTime - time(); + if (! $bruteForce->isOperationAllowed('change_password', $changePasswordProperties)) { + $waitTime = $bruteForce->getWaitTime('change_password', $changePasswordProperties); if ($waitTime > 60) { $waitMessage = sprintf(tra('Too many password change attempts. Please try again in %d minutes and %d seconds.'), floor($waitTime / 60), $waitTime % 60); } else { $waitMessage = sprintf(tra('Too many password change attempts. Please try again in %d seconds.'), $waitTime); } + http_response_code(429); $smarty->assign('msg', $waitMessage); $smarty->display('error.tpl'); die; @@ -193,6 +196,9 @@ if (isset($_REQUEST["change"]) && $access->checkCsrf()) { if ($res && $prefs['pass_history_management'] === 'y') { $userlib->addPasswordHistory($user, $_REQUEST["pass"]); } + if (($prefs['bruteforce_protection'] ?? 'n') === 'y') { + $bruteForce->success('change_password', $changePasswordProperties); + } // One-time marker: do not allow reuse of the validation session for another change unset($_SESSION['pending_new_user_password'], $_SESSION['last_validation']); View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/3bf3f1e0cbc7836e950d3d1a86121d275384f705 -- View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/3bf3f1e0cbc7836e950d3d1a86121d275384f705 You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help _______________________________________________ TikiWiki-cvs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs