Developer forum

Forum » Swift » Maintain current page on log in

Maintain current page on log in

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

How do I keep the user on the same page after logging in? For example, when on a product detail page I click log in, I want to show the same PDP again, but then as the authenticated user.

I can see in Swift that the Login.cshtml template has support for "GoBackToPage" to take you to the previous URL. However, there doesn't seem to be a way to stick the current URL as a parameter to the login page. Am I missing something?

Imar

 


Replies

 
Suzi Louring
Suzi Louring
Reply

+1

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

If you remove this setting:

You should be redirected to the previous page (unless the user has a redirect page set and that feature is enabled).

Except - the login template have a small bug related to this I just fixed (devops#13310).

Changing this line:
redirectPage = string.IsNullOrEmpty(goBackToPage) ? GetString("UserManagement:User.Login.SuccessRedirectToPage") : redirectPage;

to this:

redirectPage = string.IsNullOrEmpty(goBackToPage) && !string.IsNullOrEmpty(GetString("UserManagement:User.Login.SuccessRedirectToPage")) ? GetString("UserManagement:User.Login.SuccessRedirectToPage") : redirectPage;
 
Suzi Louring
Suzi Louring
Reply

Wuhuuu, thanks :)

 

You must be logged in to post in the forum