Fix middleware if cookie does not exist.

This commit is contained in:
Franz Liedke 2015-06-03 03:36:17 +02:00
parent 07ef273d1b
commit eb7dc1a7fe

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);