diff options
Diffstat (limited to 'lib/private/User/Session.php')
-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; + } } /** |