Skip to content

Commit

Permalink
Use redirect for login
Browse files Browse the repository at this point in the history
  • Loading branch information
riasvdv committed Nov 14, 2024
1 parent 4e114b6 commit 784a3c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/Http/Auth/Controllers/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected function sendLoginResponse(Request $request)

flash()->success('You are now logged in');

return redirect()->to(session()->get('next', route('products.index')));
return redirect()->to($request->get('redirect') ?? session()->get('next', route('products.index')));
}

protected function onlyAllowSpatieRedirects(Request $request): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</div>
</div>

<form class="space-y-6" action="{{ route('login') }}" method="POST">
<form class="space-y-6" action="{{ route('login') }}?redirect={{ request()->url() }}" method="POST">
@csrf

<x-field>
Expand Down

0 comments on commit 784a3c8

Please sign in to comment.