Thanks to the direction of Mruf, I was able to figure this out. Not sure if this is the best implementation, but it seems to work.
Basically, I paste the hash value into the form, as Mruf suggested, and then extend the handleUserWasAuthenticated function in AuthController
login.blade.php
<script type="text/javascript" > $( document ).ready(function() { $('.urlHash').val(window.location.hash); }); </script> <form id="login-form" role="form" method="POST" action="{{ url('/login') }}"> <input type="hidden" class="form-control urlHash" name="urlHash" value=""> .... </form>
AuthController.php
protected function handleUserWasAuthenticated(Request $request, $throttles) { if ($throttles) { $this->clearLoginAttempts($request); } if (method_exists($this, 'authenticated')) { return $this->authenticated($request, Auth::guard($this->getGuard())->user()); } // old code: return redirect()->intended($this->redirectPath()); $newRequest = redirect()->intended($this->redirectPath()); $newRequest->setTargetUrl($newRequest->getTargetUrl() . $request->urlHash); return $newRequest; }
source share