Skip to content

Commit 482c5c6

Browse files
authored
Merge pull request #145 from nextcloud/revert-144-feature/noid/use-new-dispatcher-for-password_policy
Revert "Use new dispatcher for password policy event"
2 parents 56d412c + 0f55c3d commit 482c5c6

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<category>auth</category>
2323
<dependencies>
2424
<php min-version="7.1"/>
25-
<nextcloud min-version="18" max-version="19"/>
25+
<nextcloud min-version="14" max-version="19"/>
2626
</dependencies>
2727
<settings>
2828
<admin>\OCA\UserSQL\Settings\Admin</admin>

lib/Backend/UserBackend.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@
3434
use OCA\UserSQL\Model\User;
3535
use OCA\UserSQL\Properties;
3636
use OCA\UserSQL\Repository\UserRepository;
37-
use OCP\EventDispatcher\IEventDispatcher;
3837
use OCP\IConfig;
3938
use OCP\IL10N;
4039
use OCP\ILogger;
41-
use OCP\Security\Events\ValidatePasswordPolicyEvent;
4240
use OCP\User\Backend\ABackend;
4341
use OCP\User\Backend\ICheckPasswordBackend;
4442
use OCP\User\Backend\ICountUsersBackend;
@@ -98,10 +96,6 @@ final class UserBackend extends ABackend implements
9896
* @var EventDispatcher The event dispatcher.
9997
*/
10098
private $eventDispatcher;
101-
/**
102-
* @var IEventDispatcher The new event dispatcher.
103-
*/
104-
private $newEventDispatcher;
10599
/**
106100
* @var IUserAction[] The actions to execute.
107101
*/
@@ -118,12 +112,11 @@ final class UserBackend extends ABackend implements
118112
* @param IL10N $localization The localization service.
119113
* @param IConfig $config The config instance.
120114
* @param EventDispatcher $eventDispatcher The event dispatcher.
121-
* @param IEventDispatcher $newEventDispatcher The new event dispatcher.
122115
*/
123116
public function __construct(
124117
$AppName, Cache $cache, ILogger $logger, Properties $properties,
125118
UserRepository $userRepository, IL10N $localization, IConfig $config,
126-
EventDispatcher $eventDispatcher, IEventDispatcher $newEventDispatcher
119+
EventDispatcher $eventDispatcher
127120
) {
128121
$this->appName = $AppName;
129122
$this->cache = $cache;
@@ -133,7 +126,6 @@ public function __construct(
133126
$this->localization = $localization;
134127
$this->config = $config;
135128
$this->eventDispatcher = $eventDispatcher;
136-
$this->newEventDispatcher = $newEventDispatcher;
137129
$this->actions = [];
138130

139131
$this->initActions();
@@ -523,8 +515,10 @@ public function setPassword(string $uid, string $password): bool
523515
return false;
524516
}
525517

526-
$event = new ValidatePasswordPolicyEvent($password);
527-
$this->newEventDispatcher->dispatchTyped($event);
518+
$event = new GenericEvent($password);
519+
$this->eventDispatcher->dispatch(
520+
'OCP\PasswordPolicy::validate', $event
521+
);
528522

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

0 commit comments

Comments
 (0)