Revert "Use new dispatcher for password policy event"
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
<category>auth</category>
|
<category>auth</category>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<php min-version="7.1"/>
|
<php min-version="7.1"/>
|
||||||
<nextcloud min-version="18" max-version="19"/>
|
<nextcloud min-version="14" max-version="19"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<settings>
|
<settings>
|
||||||
<admin>\OCA\UserSQL\Settings\Admin</admin>
|
<admin>\OCA\UserSQL\Settings\Admin</admin>
|
||||||
|
|||||||
@@ -34,11 +34,9 @@ use OCA\UserSQL\Crypto\IPasswordAlgorithm;
|
|||||||
use OCA\UserSQL\Model\User;
|
use OCA\UserSQL\Model\User;
|
||||||
use OCA\UserSQL\Properties;
|
use OCA\UserSQL\Properties;
|
||||||
use OCA\UserSQL\Repository\UserRepository;
|
use OCA\UserSQL\Repository\UserRepository;
|
||||||
use OCP\EventDispatcher\IEventDispatcher;
|
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\ILogger;
|
use OCP\ILogger;
|
||||||
use OCP\Security\Events\ValidatePasswordPolicyEvent;
|
|
||||||
use OCP\User\Backend\ABackend;
|
use OCP\User\Backend\ABackend;
|
||||||
use OCP\User\Backend\ICheckPasswordBackend;
|
use OCP\User\Backend\ICheckPasswordBackend;
|
||||||
use OCP\User\Backend\ICountUsersBackend;
|
use OCP\User\Backend\ICountUsersBackend;
|
||||||
@@ -98,10 +96,6 @@ final class UserBackend extends ABackend implements
|
|||||||
* @var EventDispatcher The event dispatcher.
|
* @var EventDispatcher The event dispatcher.
|
||||||
*/
|
*/
|
||||||
private $eventDispatcher;
|
private $eventDispatcher;
|
||||||
/**
|
|
||||||
* @var IEventDispatcher The new event dispatcher.
|
|
||||||
*/
|
|
||||||
private $newEventDispatcher;
|
|
||||||
/**
|
/**
|
||||||
* @var IUserAction[] The actions to execute.
|
* @var IUserAction[] The actions to execute.
|
||||||
*/
|
*/
|
||||||
@@ -118,12 +112,11 @@ final class UserBackend extends ABackend implements
|
|||||||
* @param IL10N $localization The localization service.
|
* @param IL10N $localization The localization service.
|
||||||
* @param IConfig $config The config instance.
|
* @param IConfig $config The config instance.
|
||||||
* @param EventDispatcher $eventDispatcher The event dispatcher.
|
* @param EventDispatcher $eventDispatcher The event dispatcher.
|
||||||
* @param IEventDispatcher $newEventDispatcher The new event dispatcher.
|
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
$AppName, Cache $cache, ILogger $logger, Properties $properties,
|
$AppName, Cache $cache, ILogger $logger, Properties $properties,
|
||||||
UserRepository $userRepository, IL10N $localization, IConfig $config,
|
UserRepository $userRepository, IL10N $localization, IConfig $config,
|
||||||
EventDispatcher $eventDispatcher, IEventDispatcher $newEventDispatcher
|
EventDispatcher $eventDispatcher
|
||||||
) {
|
) {
|
||||||
$this->appName = $AppName;
|
$this->appName = $AppName;
|
||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
@@ -133,7 +126,6 @@ final class UserBackend extends ABackend implements
|
|||||||
$this->localization = $localization;
|
$this->localization = $localization;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->newEventDispatcher = $newEventDispatcher;
|
|
||||||
$this->actions = [];
|
$this->actions = [];
|
||||||
|
|
||||||
$this->initActions();
|
$this->initActions();
|
||||||
@@ -523,8 +515,10 @@ final class UserBackend extends ABackend implements
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$event = new ValidatePasswordPolicyEvent($password);
|
$event = new GenericEvent($password);
|
||||||
$this->newEventDispatcher->dispatchTyped($event);
|
$this->eventDispatcher->dispatch(
|
||||||
|
'OCP\PasswordPolicy::validate', $event
|
||||||
|
);
|
||||||
|
|
||||||
$user = $this->userRepository->findByUid($uid);
|
$user = $this->userRepository->findByUid($uid);
|
||||||
if (!($user instanceof User)) {
|
if (!($user instanceof User)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user