From 1e04a20220b2dc3b859ea0f52a44dcf94bc75ff5 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Wed, 1 Jul 2015 22:45:14 +0200 Subject: [PATCH] Fix login We cannot write to an empty response. --- src/Forum/Actions/LoginAction.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Forum/Actions/LoginAction.php b/src/Forum/Actions/LoginAction.php index a166d2b03..b835c76c5 100644 --- a/src/Forum/Actions/LoginAction.php +++ b/src/Forum/Actions/LoginAction.php @@ -5,6 +5,7 @@ use Flarum\Forum\Events\UserLoggedIn; use Flarum\Core\Repositories\UserRepositoryInterface; use Psr\Http\Message\ServerRequestInterface as Request; use Zend\Diactoros\Response\EmptyResponse; +use Zend\Diactoros\Response\JsonResponse; class LoginAction extends BaseAction { @@ -32,11 +33,8 @@ class LoginAction extends BaseAction if (isset($data->userId)) { event(new UserLoggedIn($this->users->findOrFail($data->userId), $data->token)); - $response = $this->success(); - $response->getBody()->write(json_encode($data)); - return $this->withRememberCookie( - $response, + new JsonResponse($data), $data->token ); } else {