diff options
author | Christoph Wurst <christoph@owncloud.com> | 2016-06-08 15:03:15 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@owncloud.com> | 2016-06-08 15:03:15 +0200 |
commit | 46e26f6b4939759c6037fe848c5f56854a70ca3b (patch) | |
tree | b4251f0d3b359c1fac7d938e5165c5be694863fb | |
parent | ec929f07f21341ed0e679ca27dc7e3cacd8b1b2d (diff) | |
download | nextcloud-server-46e26f6b4939759c6037fe848c5f56854a70ca3b.tar.gz nextcloud-server-46e26f6b4939759c6037fe848c5f56854a70ca3b.zip |
catch sessionnotavailable exception if memory session is used
-rw-r--r-- | lib/private/User/Session.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index e5a2cf9c441..e1ede95e2ae 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -460,7 +460,6 @@ class Session implements IUserSession, Emitter { * @param string $uid user UID * @param string $loginName login name * @param string $password - * @throws SessionNotAvailableException * @return boolean */ public function createSessionToken(IRequest $request, $uid, $loginName, $password = null) { @@ -469,10 +468,16 @@ class Session implements IUserSession, Emitter { return false; } $name = isset($request->server['HTTP_USER_AGENT']) ? $request->server['HTTP_USER_AGENT'] : 'unknown browser'; - $sessionId = $this->session->getId(); - $pwd = $this->getPassword($password); - $this->tokenProvider->generateToken($sessionId, $uid, $loginName, $pwd, $name); - return true; + try { + $sessionId = $this->session->getId(); + $pwd = $this->getPassword($password); + $this->tokenProvider->generateToken($sessionId, $uid, $loginName, $pwd, $name); + return true; + } catch (SessionNotAvailableException $ex) { + // This can happen with OCC, where a memory session is used + // if a memory session is used, we shouldn't create a session token anyway + return false; + } } /** |