3434use OCA \UserSQL \Model \User ;
3535use OCA \UserSQL \Properties ;
3636use OCA \UserSQL \Repository \UserRepository ;
37+ use OCP \EventDispatcher \IEventDispatcher ;
3738use OCP \IConfig ;
3839use OCP \IL10N ;
3940use OCP \ILogger ;
41+ use OCP \Security \Events \ValidatePasswordPolicyEvent ;
4042use OCP \User \Backend \ABackend ;
4143use OCP \User \Backend \ICheckPasswordBackend ;
4244use OCP \User \Backend \ICountUsersBackend ;
4648use OCP \User \Backend \IProvideAvatarBackend ;
4749use OCP \User \Backend \ISetDisplayNameBackend ;
4850use OCP \User \Backend \ISetPasswordBackend ;
49- use Symfony \Component \EventDispatcher \EventDispatcher ;
50- use Symfony \Component \EventDispatcher \GenericEvent ;
5151
5252/**
5353 * The SQL user backend manager.
@@ -93,7 +93,7 @@ final class UserBackend extends ABackend implements
9393 */
9494 private $ config ;
9595 /**
96- * @var EventDispatcher The event dispatcher.
96+ * @var IEventDispatcher The event dispatcher.
9797 */
9898 private $ eventDispatcher ;
9999 /**
@@ -104,19 +104,19 @@ final class UserBackend extends ABackend implements
104104 /**
105105 * The default constructor.
106106 *
107- * @param string $AppName The application name.
108- * @param Cache $cache The cache instance.
109- * @param ILogger $logger The logger instance.
110- * @param Properties $properties The properties array.
111- * @param UserRepository $userRepository The user repository.
112- * @param IL10N $localization The localization service.
113- * @param IConfig $config The config instance.
114- * @param EventDispatcher $eventDispatcher The event dispatcher.
107+ * @param string $AppName The application name.
108+ * @param Cache $cache The cache instance.
109+ * @param ILogger $logger The logger instance.
110+ * @param Properties $properties The properties array.
111+ * @param UserRepository $userRepository The user repository.
112+ * @param IL10N $localization The localization service.
113+ * @param IConfig $config The config instance.
114+ * @param IEventDispatcher $eventDispatcher The event dispatcher.
115115 */
116116 public function __construct (
117117 $ AppName , Cache $ cache , ILogger $ logger , Properties $ properties ,
118118 UserRepository $ userRepository , IL10N $ localization , IConfig $ config ,
119- EventDispatcher $ eventDispatcher
119+ IEventDispatcher $ eventDispatcher
120120 ) {
121121 $ this ->appName = $ AppName ;
122122 $ this ->cache = $ cache ;
@@ -515,10 +515,8 @@ public function setPassword(string $uid, string $password): bool
515515 return false ;
516516 }
517517
518- $ event = new GenericEvent ($ password );
519- $ this ->eventDispatcher ->dispatch (
520- 'OCP\PasswordPolicy::validate ' , $ event
521- );
518+ $ event = new ValidatePasswordPolicyEvent ($ password );
519+ $ this ->eventDispatcher ->dispatchTyped ($ event );
522520
523521 $ user = $ this ->userRepository ->findByUid ($ uid );
524522 if (!($ user instanceof User)) {
0 commit comments