catch sessionnotavailable exception if memory session is used

This commit is contained in:
Christoph Wurst 2016-06-08 15:03:15 +02:00
parent ec929f07f2
commit 46e26f6b49
No known key found for this signature in database
GPG key ID: FEECD2543CA6EAF0

View file

@ -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;
}
}
/**