File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3535use OCP \Security \Events \GenerateSecurePasswordEvent ;
3636use OCP \Security \Events \ValidatePasswordPolicyEvent ;
3737use OCP \User \Events \BeforePasswordUpdatedEvent ;
38+ use OCP \User \Events \BeforeUserLoggedInEvent ;
3839use OCP \User \Events \PasswordUpdatedEvent ;
39- use OCP \User \Events \PostLoginEvent ;
4040use Symfony \Component \EventDispatcher \GenericEvent ;
4141
4242class Application extends App {
@@ -98,14 +98,14 @@ function (Event $event) use ($container) {
9898 }
9999 );
100100 $ eventDispatcher ->addListener (
101- PostLoginEvent ::class,
101+ BeforeUserLoggedInEvent ::class,
102102 function (Event $ event ) use ($ container ) {
103- if (!$ event instanceof PostLoginEvent ) {
103+ if (!$ event instanceof BeforeUserLoggedInEvent ) {
104104 return ;
105105 }
106106 /** @var ComplianceService $complianceUpdater */
107107 $ complianceUpdater = $ container ->query (ComplianceService::class);
108- $ complianceUpdater ->entryControl ($ event ->getUser (), $ event ->getPassword (), $ event -> isTokenLogin ());
108+ $ complianceUpdater ->entryControl ($ event ->getUsername (), $ event ->getPassword ());
109109 }
110110 );
111111
Original file line number Diff line number Diff line change @@ -85,14 +85,15 @@ public function audit(IUser $user, string $password) {
8585 /**
8686 * @throws LoginException
8787 */
88- public function entryControl (IUser $ user , string $ password , bool $ isTokenLogin ) {
88+ //public function entryControl(IUser $user, string $password, bool $isTokenLogin) {
89+ public function entryControl (string $ loginName , string $ password ) {
90+ $ uid = $ loginName ;
91+ \OCP \Util::emitHook ( '\OCA\Files_Sharing\API\Server2Server ' , 'preLoginNameUsedAsUserName ' , ['uid ' => &$ uid ]);
8992 foreach ($ this ->getInstance (IEntryControl::class) as $ instance ) {
9093 try {
91- $ instance ->entryControl ($ user , $ password , $ isTokenLogin );
94+ $ user = \OC ::$ server ->getUserManager ()->get ($ uid );
95+ $ instance ->entryControl ($ user , $ password , false );
9296 } catch (HintException $ e ) {
93- if ($ this ->userSession ->isLoggedIn ()) {
94- $ this ->userSession ->logout ();
95- }
9697 throw new LoginException ($ e ->getHint ());
9798 }
9899 }
You can’t perform that action at this time.
0 commit comments