-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[stable10] Move AccountCheckException to public api #31933
Changes from all commits
39defdc
621a647
be356ae
d030017
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -463,6 +463,7 @@ public function prepareUserLogin($firstTimeLogin = false) { | |
|
||
// trigger any other initialization | ||
$this->eventDispatcher->dispatch(IUser::class . '::firstLogin', new GenericEvent($this->getUser())); | ||
$this->eventDispatcher->dispatch('user.firstlogin', new GenericEvent($this->getUser())); | ||
} | ||
} | ||
|
||
|
@@ -517,7 +518,6 @@ private function loginWithPassword($login, $password) { | |
|
||
$user = $this->manager->checkPassword($login, $password); | ||
if ($user === false) { | ||
$this->manager->emit('\OC\User', 'failedLogin', [$login]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happened to these ? obsolete ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the emit call is within emitFailedLogin |
||
$this->emitFailedLogin($login); | ||
return false; | ||
} | ||
|
@@ -660,7 +660,6 @@ public function loginWithApache(IApacheBackend $apacheBackend) { | |
|
||
$user = $this->manager->get($uid); | ||
if ($user === null) { | ||
$this->manager->emit('\OC\User', 'failedLogin', [$uid]); | ||
$this->emitFailedLogin($uid); | ||
return false; | ||
} | ||
|
@@ -954,9 +953,10 @@ public function tryAuthModuleLogin(IRequest $request) { | |
* @param IUser $user The user | ||
* @param String $password The user's password | ||
* @return boolean True if the user can be authenticated, false otherwise | ||
* @throws LoginException if an app canceld the login process or the user is not enabled | ||
* @throws LoginException if an app canceled the login process or the user is not enabled | ||
*/ | ||
protected function loginUser($user, $password) { | ||
protected function loginUser(IUser $user = null, $password) { | ||
$uid = $user === null ? '' : $user->getUID(); | ||
return $this->emittingCall(function () use (&$user, &$password) { | ||
if (is_null($user)) { | ||
//Cannot extract the uid when $user is null, hence pass null | ||
|
@@ -985,7 +985,9 @@ protected function loginUser($user, $password) { | |
} | ||
|
||
return true; | ||
}, ['before' => ['uid' => $user, 'password' => $password], 'after' => ['uid' => $user, 'password' => $password]], 'user', 'login'); | ||
}, ['before' => ['user' => $user, 'uid' => $uid, 'password' => $password], | ||
'after' => ['user' => $user, 'uid' => $uid, 'password' => $password]], | ||
'user', 'login'); | ||
} | ||
|
||
/** | ||
|
@@ -1168,11 +1170,13 @@ protected function getAuthModules($includeBuiltIn) { | |
} | ||
|
||
/** | ||
* This method triggers symfony event for failed login | ||
* | ||
* This method triggers symfony event for failed login as well as | ||
* emits via the emitter in user manager | ||
* @param string $user | ||
*/ | ||
protected function emitFailedLogin($user) { | ||
$this->manager->emit('\OC\User', 'failedLogin', [$user]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @PVince81 see here |
||
|
||
$loginFailedEvent = new GenericEvent(null, ['user' => $user]); | ||
$this->eventDispatcher->dispatch('user.loginfailed', $loginFailedEvent); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ | |
*/ | ||
use OCP\API; | ||
use OCP\AppFramework\Http; | ||
use OC\Authentication\Exceptions\AccountCheckException; | ||
use OCP\Authentication\Exceptions\AccountCheckException; | ||
|
||
/** | ||
* @author Bart Visscher <[email protected]> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why needing another event ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to fix the naming convention