-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
- Loading branch information
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php b/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php | ||
index a72a7a40016..c6738de65df 100644 | ||
--- a/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php | ||
+++ b/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php | ||
@@ -88,7 +88,7 @@ class PasswordConfirmationMiddleware extends Middleware { | ||
|
||
$lastConfirm = (int) $this->session->get('last-password-confirm'); | ||
// we can't check the password against a SAML backend, so skip password confirmation in this case | ||
- 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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from os import environ, path | ||
from subprocess import run | ||
from time import sleep | ||
|
||
import pytest | ||
from gfixture import NC | ||
|
||
from nc_py_api import NextcloudException | ||
|
||
# These tests should be run only on GitHub and only in special environment. | ||
|
||
|
||
@pytest.mark.skipif("NC_AUTH_USER" not in environ or "NC_AUTH_PASS" not in environ, reason="Needs login & paasword.") | ||
@pytest.mark.skipif(NC is None, reason="Not available for NextcloudApp.") | ||
@pytest.mark.skipif(environ.get("CI", None) is None, reason="run only on GitHub") | ||
def test_password_confirmation(): | ||
# patch "PasswordConfirmationMiddleware.php" decreasing asking before Password Confirmation from 30 min to 15 secs | ||
patch_path = path.join(path.dirname(path.abspath(__file__)), "data/nc_pass_confirm.patch") | ||
cwd_path = path.dirname(path.dirname(path.dirname(path.abspath(__file__)))) | ||
run(["patch", "-p", "1", "-i", patch_path], cwd=cwd_path, check=True) | ||
sleep(6) | ||
NC.update_server_info() | ||
old_adapter = NC._session.adapter | ||
try: | ||
NC.users.create("test_cover_user_spec", password="ThisIsA54StrongPassword013") | ||
except NextcloudException: | ||
pass | ||
NC.users.delete("test_cover_user_spec") | ||
assert old_adapter != NC._session.adapter | ||
run(["git", "apply", "-R", patch_path], cwd=cwd_path, check=True) |