Login Redirection

3 years ago
#16354 Quote
  • 49
When a customer logs into the website, they always get redirected to the home page. I am trying to modify this so that once they login, they are then redirected to the /customer/info page of their account.  I have read in some forms this was a theme issue not a nopcommerce issue but I am not sure how to fix this.

I tried all these calls in the customercontroller.cs file:

//   return RedirectToRoute("CustomerInfo", new { controller = "Customer", action = "Info" });
//   return Redirect("customer/info");
//   return RedirectToRoute("customerinfo", new { action = "Info" });
//   return Response.RedirectToRoute("CustomerInfo");

they all invoke info customer call and view
but in all efforts, the redirect to the home page gets invoked

I also have modified info.cshtml
@using (Html.BeginForm("Info","Customer",FormMethod.Post, new { data_ajax = "false" }))

But still no luck at all.  Any assistance would be appreciated.

Nate Kindom
3 years ago
#16357 Quote
  • 49
Ok just a follow up on this, I have disabled the "popup login" setting in the theme and it seems to work now with my changes done in the customercontroller.cs file.  Is there a way to make this work with the popup login option enabled?
Nate Kindom
3 years ago
#16400 Quote
  • 49
Nate Kindom
3 years ago
#20875 Quote
  • Moderator
  • 1566
Hi jkeeler,

Please note that the Loin popup uses Ajax calls to make the login.
So you need to make the redirect in the javascript instead.
Currently if the login is successful we simply reload the current page.
If you want to redirect to a specific page you need to change that code.
In the Pavilion.js file you need to find this function handleLoginModalPopup and change this line of code:

if (dataObj.find('#login-modal-window-static-resources').length > 0) {
                } else {

You need to change the code in Bold with something like this:

window.location.href = "https://your-new-location";

Hope this helps!
Boyko Stanev
21 days ago
#22245 Quote
  • 3
I am using the Emporium Theme. When a user navigates to any page away from the home page without logging in to the site and then they try to login using the "My Account" login form top right corner of the theme they are redirected to the Home page away from their last page. Is there a way to ensure that the user stays on the current page after sucessful login?