diff --git a/lib/Service/RoomService.php b/lib/Service/RoomService.php index 973c6ae6bd3..9e4922c6fe6 100644 --- a/lib/Service/RoomService.php +++ b/lib/Service/RoomService.php @@ -166,13 +166,11 @@ public function createConversation(int $type, string $name, ?IUser $owner = null } if ($type === Room::TYPE_PUBLIC && $password === '' && $this->config->isPasswordEnforced() === true) { - throw new InvalidArgumentException('password'); + throw new PasswordException(PasswordException::REASON_VALUE, $this->l10n->t('Password needs to be set')); } if ($type !== Room::TYPE_PUBLIC) { $room = $this->manager->createRoom($type, $name, $objectType, $objectId); - } elseif ($password === '') { - throw new PasswordException(PasswordException::REASON_VALUE, $this->l10n->t('Password needs to be set')); } else { $event = new ValidatePasswordPolicyEvent($password); try {