cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

specific url redirect after login

Former Member
0 Likes
1,244

Hi, In PDP page i have wishlist button , if anonymous user click wishlist button then redirect to login page and after completing login it will be redirect to PDP page rather than "defaultTargetUrl". Same for Save Cart Page Button which is in Cart page . In this two scenario we want back to my previous page and for others my "defaultTargetUrl" will work.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Likes

Hi Sandeep,

The referer concept is provided OOTB. Just use the check whether the user is authorized (i.e. login or not) . Infact this is also OOTB (refer AuthenticationController.java) . If the user successfully login he'll be redirected to the same PDP/ cart page. You can find the implementation at StorefrontAuthenticationSuccessHandler.determineTargetUrl() (Refer the super implementation). Hope this resolves your issue. Let me know if you face something.

0 Likes

1: Use annotation @RequireHardLogIn on your wishlist controller method.

2: Add a filter where you save the last visited page. sessionService.setAttribute("referal", httpServletRequest.getContextPath());

3: Extend StorefrontAuthenticationSuccessHandler#onAuthenticationSuccess, retrieve the referer from the session service and call getRedirectStrategy().sendRedirect(url);

Former Member
0 Likes

can you provide me the answer if you have?

Former Member
0 Likes

Have please you an answer for this?