diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-05-24 17:51:49 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-05-24 17:51:49 +0200 |
commit | d3fb5d618ea5902c989c39d72fd6ac2e5bcb65ed (patch) | |
tree | 815818e3077c629a5b5fe8a63213e4867546d5b6 /lib/private/User/Session.php | |
parent | e8c37943081975b01f5dedc2284892a5335322f8 (diff) | |
parent | ad10485cec4377119aa14749e8e4aeda6e707f8e (diff) | |
download | nextcloud-server-d3fb5d618ea5902c989c39d72fd6ac2e5bcb65ed.tar.gz nextcloud-server-d3fb5d618ea5902c989c39d72fd6ac2e5bcb65ed.zip |
Merge pull request #24748 from owncloud/login-explicitly
Log in explicitly, save login name when generating browser/device tokens
Diffstat (limited to 'lib/private/User/Session.php')
-rw-r--r-- | lib/private/User/Session.php | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index ddd86a56abb..749f395e280 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -219,7 +219,7 @@ class Session implements IUserSession, Emitter { return; } - if ($this->manager->checkPassword($user->getUID(), $pwd) === false + if ($this->manager->checkPassword($token->getLoginName(), $pwd) === false || !$user->isEnabled()) { // Password has changed or user was disabled -> log user out $this->logout(); @@ -388,25 +388,23 @@ class Session implements IUserSession, Emitter { * * @param IRequest $request * @param string $uid user UID + * @param string $loginName login name * @param string $password * @return boolean */ - public function createSessionToken(IRequest $request, $uid, $password) { + public function createSessionToken(IRequest $request, $uid, $loginName, $password) { if (is_null($this->manager->get($uid))) { // User does not exist return false; } $name = isset($request->server['HTTP_USER_AGENT']) ? $request->server['HTTP_USER_AGENT'] : 'unknown browser'; - $loggedIn = $this->login($uid, $password); - if ($loggedIn) { - try { - $sessionId = $this->session->getId(); - $this->tokenProvider->generateToken($sessionId, $uid, $password, $name); - } catch (SessionNotAvailableException $ex) { - - } + try { + $sessionId = $this->session->getId(); + $this->tokenProvider->generateToken($sessionId, $uid, $loginName, $password, $name); + } catch (SessionNotAvailableException $ex) { + } - return $loggedIn; + return true; } /** |