Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<category>auth</category>
<dependencies>
<php min-version="7.1"/>
<nextcloud min-version="14" max-version="19"/>
<nextcloud min-version="18" max-version="19"/>
</dependencies>
<settings>
<admin>\OCA\UserSQL\Settings\Admin</admin>
Expand Down
16 changes: 11 additions & 5 deletions lib/Backend/UserBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
use OCA\UserSQL\Model\User;
use OCA\UserSQL\Properties;
use OCA\UserSQL\Repository\UserRepository;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IL10N;
use OCP\ILogger;
use OCP\Security\Events\ValidatePasswordPolicyEvent;
use OCP\User\Backend\ABackend;
use OCP\User\Backend\ICheckPasswordBackend;
use OCP\User\Backend\ICountUsersBackend;
Expand Down Expand Up @@ -96,6 +98,10 @@ final class UserBackend extends ABackend implements
* @var EventDispatcher The event dispatcher.
*/
private $eventDispatcher;
/**
* @var IEventDispatcher The new event dispatcher.
*/
private $newEventDispatcher;
/**
* @var IUserAction[] The actions to execute.
*/
Expand All @@ -112,11 +118,12 @@ final class UserBackend extends ABackend implements
* @param IL10N $localization The localization service.
* @param IConfig $config The config instance.
* @param EventDispatcher $eventDispatcher The event dispatcher.
* @param IEventDispatcher $newEventDispatcher The new event dispatcher.
*/
public function __construct(
$AppName, Cache $cache, ILogger $logger, Properties $properties,
UserRepository $userRepository, IL10N $localization, IConfig $config,
EventDispatcher $eventDispatcher
EventDispatcher $eventDispatcher, IEventDispatcher $newEventDispatcher
) {
$this->appName = $AppName;
$this->cache = $cache;
Expand All @@ -126,6 +133,7 @@ public function __construct(
$this->localization = $localization;
$this->config = $config;
$this->eventDispatcher = $eventDispatcher;
$this->newEventDispatcher = $newEventDispatcher;
$this->actions = [];

$this->initActions();
Expand Down Expand Up @@ -515,10 +523,8 @@ public function setPassword(string $uid, string $password): bool
return false;
}

$event = new GenericEvent($password);
$this->eventDispatcher->dispatch(
'OCP\PasswordPolicy::validate', $event
);
$event = new ValidatePasswordPolicyEvent($password);
$this->newEventDispatcher->dispatchTyped($event);

$user = $this->userRepository->findByUid($uid);
if (!($user instanceof User)) {
Expand Down