Properly wrap error bag in session

Second part of fixing #1683.
This commit is contained in:
Franz Liedke 2019-02-03 21:16:43 +01:00
parent 4611abe5db
commit ed43ad9c3f
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4

View File

@ -18,6 +18,7 @@ use Flarum\User\PasswordToken;
use Flarum\User\UserValidator;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Validation\Factory;
use Illuminate\Support\MessageBag;
use Illuminate\Validation\ValidationException;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface as Request;
@ -86,7 +87,7 @@ class SavePasswordController implements RequestHandlerInterface
throw new ValidationException($validator);
}
} catch (ValidationException $e) {
$request->getAttribute('session')->put('errors', $e->errors());
$request->getAttribute('session')->put('errors', new MessageBag($e->errors()));
return new RedirectResponse($this->url->to('forum')->route('resetPassword', ['token' => $token->token]));
}