Fix middleware if cookie does not exist.

This commit is contained in:
Franz Liedke 2015-06-03 03:36:17 +02:00
parent 2ba7a2044b
commit ed79f7c4ea

View File

@ -23,9 +23,7 @@ class LoginWithCookie implements MiddlewareInterface
*/
public function __invoke(Request $request, Response $response, callable $out = null)
{
$cookies = $request->getCookieParams();
if (($token = $cookies['flarum_remember']) &&
if (($token = array_get($request->getCookieParams(), 'flarum_remember')) &&
($accessToken = AccessToken::where('id', $token)->first())
) {
$this->actor->setUser($user = $accessToken->user);