From 46e26f6b4939759c6037fe848c5f56854a70ca3b Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 8 Jun 2016 15:03:15 +0200 Subject: catch sessionnotavailable exception if memory session is used --- lib/private/User/Session.php | 15 ++++++++++----- 1 file 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; + } } /** -- cgit v1.2.3