Landing Page / Redirect After Successful Login

Hi all!

Is there a possibility to set the page where a user is redirected to after a successful login?

Currently the user is on the home page, opens the login dialogue by clicking on the profile icon and remains on the homepage after he is logged in. A redirect to some special page (e.g. to the product overview) would be preferred.

Any hints?

Looking forward to your answer.

Best regards

hummer

Any ideas? :-)

Hi all!

Is there a possibility to set the page where a user is redirected to after a successful login?

Currently the user is on the home page, opens the login dialogue by clicking on the profile icon and remains on the homepage after he is logged in. A redirect to some special page (e.g. to the product overview) would be preferred.

Any hints?

Looking forward to your answer.

Best regards

hummer

Try this: https://marketplace.cs-cart.com/login-redirect.html

Hi John,

thanks for the add-on link.

The add-on behaviour is:

"This module does not allow to show your website pages to anonymous visitors and redirect your users to the page of your choosing after they login"

This is not what i want. I am fine with anonymous users. My goal is to define the page the user is redirect to after he performed a successful login. Currently he stays at the same page after login action.

Does anyone has further ideas? I appreciate your help.

Best regards

hummer

Use an auth post controller. I.e. app/addons/my_changes/controllers/common/auth.post.php with content similar to:

if( AREA == 'C' && !empty($_REQUEST['return_url']) && $mode == 'login' )
  $_REQUEST['return_url'] = fn_url("my_controller.my_mode&my_param=foo");

UNTESTED

Cool idea, thanks!

But I have problems to implement it. Are you sure, the controller is the right one? This is my code in auth.post.php:

if (!defined(‘BOOTSTRAP’)) { die(‘Access denied (0)’); }

echo ‘’;

//if( AREA == ‘C’ && !empty($_REQUEST[‘return_url’]) && $mode == ‘login’ )
// $_REQUEST[‘return_url’] = fn_url(“my_controller.my_mode&my_param=foo”);

?>

When performing a sign in (see attachment) the alert box is not fired. When e.g. clicking on the "logout" button it is fired.

Any suggestions?

Looking forward to your answer.

Best regards

hummer

signin.PNG

Not sure your browser code will happen in a POST.

You can use 'die("Got here"); instead.

Try to use app/addons/my_changes/controllers/common/auth.pre.php file since auth.php controller forces redirect after login

@tbirnseth, @eComLabs: Thanks for that team work. Switching from a post to a pre controller did the trick.

It is always a pleasure that the community helps me here. I hope to be able to pass on knowledge myself one day. But I'm still in a deep learning phase. :-)

Best regards

hummer

You are welcome! :)