From fb8802a7838b05fc390808325f358316f8e58838 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sat, 18 Jan 2025 12:17:18 +0100 Subject: [PATCH] fix(sharing): Set correct password context for share password validation Signed-off-by: Ferdinand Thiessen --- lib/private/Share20/Manager.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 3300a5d2e67dd..5911882e8083b 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -35,6 +35,7 @@ use OCP\Security\Events\ValidatePasswordPolicyEvent; use OCP\Security\IHasher; use OCP\Security\ISecureRandom; +use OCP\Security\PasswordContext; use OCP\Share; use OCP\Share\Events\BeforeShareDeletedEvent; use OCP\Share\Events\ShareAcceptedEvent; @@ -116,7 +117,8 @@ protected function verifyPassword($password) { // Let others verify the password try { - $this->dispatcher->dispatchTyped(new ValidatePasswordPolicyEvent($password)); + $event = new ValidatePasswordPolicyEvent($password, PasswordContext::SHARING); + $this->dispatcher->dispatchTyped($event); } catch (HintException $e) { /* Wrap in a 400 bad request error */ throw new HintException($e->getMessage(), $e->getHint(), 400, $e);