samedi 24 octobre 2015

Laravel 5 redirects back to home after login

I have an page where users needs to login to click on a button, if they are not logged in the are taken to the login page to login. The problem is after the login they get redirected to home page. I would like them to be redirected back to the page they where before the login but can't get it to work.

They method of the login is still 100% standard. I have tried editing this function but with no luck. Please help

public function postLogin(Request $request)
{
    $this->validate($request, [
        'email' => 'required|email', 'password' => 'required',
    ]);

    $credentials = $request->only('email', 'password');

    if ($this->auth->attempt($credentials, $request->has('remember')))
    {
        return redirect()->intended($this->redirectPath());
    }

    return redirect($this->loginPath())
                ->withInput($request->only('email', 'remember'))
                ->withErrors([
                    'email' => $this->getFailedLoginMessage(),
                ]);
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/204zwMW
via IFTTT

Aucun commentaire:

Enregistrer un commentaire