Skip to content

Commit

Permalink
Handle ajax requests in RequirePassword middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
netpok committed Oct 22, 2019
1 parent 55d28ab commit 93eb836
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Illuminate/Auth/Middleware/RequirePassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public function __construct(ResponseFactory $responseFactory, UrlGenerator $urlG
public function handle($request, Closure $next, $redirectToRoute = null)
{
if ($this->shouldConfirmPassword($request)) {
if ($request->expectsJson()) {
abort(423, 'Password confirmation required.');
}

return $this->responseFactory->redirectGuest(
$this->urlGenerator->route($redirectToRoute ?? 'password.confirm')
);
Expand Down

0 comments on commit 93eb836

Please sign in to comment.