diff --git a/tests/actual_tests/z_special_test.py b/tests/actual_tests/z_special_test.py index 14802399..e24371cb 100644 --- a/tests/actual_tests/z_special_test.py +++ b/tests/actual_tests/z_special_test.py @@ -39,8 +39,14 @@ async def test_password_confirmation_async(anc_client): def _test_password_confirmation() -> tuple[str, str]: # patch "PasswordConfirmationMiddleware.php" decreasing asking before Password Confirmation from 30 min to 5 secs - patch_path = path.join(path.dirname(path.dirname(path.abspath(__file__))), "data/nc_pass_confirm.patch") - cwd_path = path.dirname(path.dirname(path.dirname(path.dirname(path.abspath(__file__))))) - run(["patch", "-p", "1", "-i", patch_path], cwd=cwd_path, check=True) + patch_success = False + for i in ("data/nc_pass_confirm.patch", "data/nc_pass_confirm_nc31.patch"): + patch_path = path.join(path.dirname(path.dirname(path.abspath(__file__))), i) + cwd_path = path.dirname(path.dirname(path.dirname(path.dirname(path.abspath(__file__))))) + r = run(["patch", "-p", "1", "-i", patch_path], cwd=cwd_path) + if r.returncode == 0: + patch_success = True + break + assert patch_success sleep(6) return patch_path, cwd_path diff --git a/tests/data/nc_pass_confirm_nc31.patch b/tests/data/nc_pass_confirm_nc31.patch new file mode 100644 index 00000000..722c03ef --- /dev/null +++ b/tests/data/nc_pass_confirm_nc31.patch @@ -0,0 +1,13 @@ +diff --git a/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php b/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php +index 5ff9d7386da..04edf4e9991 100644 +--- a/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php ++++ b/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php +@@ -93,7 +93,7 @@ class PasswordConfirmationMiddleware extends Middleware { + + $lastConfirm = (int)$this->session->get('last-password-confirm'); + // TODO: confirm excludedUserBackEnds can go away and remove it +- if (!isset($this->excludedUserBackEnds[$backendClassName]) && $lastConfirm < ($this->timeFactory->getTime() - (30 * 60 + 15))) { // allow 15 seconds delay ++ if (!isset($this->excludedUserBackEnds[$backendClassName]) && $lastConfirm < ($this->timeFactory->getTime() - 5)) { // allow 5 seconds delay + throw new NotConfirmedException(); + } + }