mirror of
https://github.com/flarum/framework.git
synced 2024-12-13 07:03:35 +08:00
Fix middleware if cookie does not exist.
This commit is contained in:
parent
07ef273d1b
commit
eb7dc1a7fe
|
@ -23,9 +23,7 @@ class LoginWithCookie implements MiddlewareInterface
|
||||||
*/
|
*/
|
||||||
public function __invoke(Request $request, Response $response, callable $out = null)
|
public function __invoke(Request $request, Response $response, callable $out = null)
|
||||||
{
|
{
|
||||||
$cookies = $request->getCookieParams();
|
if (($token = array_get($request->getCookieParams(), 'flarum_remember')) &&
|
||||||
|
|
||||||
if (($token = $cookies['flarum_remember']) &&
|
|
||||||
($accessToken = AccessToken::where('id', $token)->first())
|
($accessToken = AccessToken::where('id', $token)->first())
|
||||||
) {
|
) {
|
||||||
$this->actor->setUser($user = $accessToken->user);
|
$this->actor->setUser($user = $accessToken->user);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user