Support the ongoing development of Laravel.io →
Authentication Security

Hi there,

I would like users to click a link in an email, which would send them to a login form. Once logged in I would like them to be redirected to the original link in the email.

I have my login setup and working, can anyone please help me with storing the original url and redirecting?

Many thanks

Last updated 3 years ago.
0

If you're using the default laravel Auth handler, you can use Redirect::intended()

http://laravel.com/docs/4.2/security#authenticating-users

Last updated 3 years ago.
0

Thanks for the reply.

I would like this link to point to the login page, then send the user to form.php once logged in

https://xx.xx.xx.x/test/test/form.php?p=259&c=gdfg56y6y

I keep getting sent to the fallback url and not the intended page.

Can anyone help?

// check password with hash in db
if (Hash::check(Input::get('password'), $user->password)){
//log them in
Auth::login($user);
// redirect to original path, otherwise fallback to 'test'
return Redirect::intended('test');
}else{
// password fail, redirect to login
return Redirect::to('admin/login')->with('message', 'Incorrect password, please try again.');
}
Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

mharrisweb mharrisweb Joined 23 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.