cancel
Showing results for 
Search instead for 
Did you mean: 

Url redirection after login

Former Member
0 Kudos

Hi All,

After removing url encoding attributes from url, it isnot landing on previous page after login...it is landing on home page....

If anyone have any idea please let me know.

Thanks

Navneet

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

check the code in class WebHttpSessionRequestCache. your contextPath is empty and this is why the relURl="/".

             String modifiedContextPath = contextPath;
             final String urlEncodingAttributes = getSessionService().getAttribute(WebConstants.URL_ENCODING_ATTRIBUTES);
             if (urlEncodingAttributes != null && !url.contains(urlEncodingAttributes)
                     && modifiedContextPath.contains(urlEncodingAttributes))
             {
                 modifiedContextPath = StringUtils.remove(modifiedContextPath, urlEncodingAttributes);
             }
             if (StringUtils.isEmpty(relUrl) || StringUtils.isEmpty(modifiedContextPath))
             {
                 relUrl = "/";
             }
             else
             {
                 relUrl = relUrl.substring(relUrl.indexOf(modifiedContextPath) + modifiedContextPath.length());
             }
             return relUrl;
Former Member
0 Kudos

Hi Navneet,

Please find below the workaround for your need.

In spring-security-config.xml located in hybris\bin\ext-template\yacceleratorstorefront\web\webroot\WEB-INF\config, update excludeRedirectUrlRequestMatcher bean as given below.

 <bean id="excludeRedirectUrlRequestMatcher" class="de.hybris.platform.yacceleratorstorefront.security.ExcludeUrlRequestMatcher">
     <property name="excludeUrlSet">
         <set>
             <value>/guest/.*</value>
             <value>/orderConfirmation/.*</value>
             <value>/login</value>
             <value>/login/checkout</value>
         </set>
     </property>
 

The excludeUrlSet which contains the list of URLS for which the redirection is based on property defaultTargetUrl of bean loginAuthenticationSuccessHandler. You can modify the property to "/" if you want to redirect to your homepage once you login or the page of your choice based on that property as shown below which is available in the same file.

 <property name="defaultTargetUrl" value="/"/>

Thanks,

Jayahar

Former Member
0 Kudos

I want to land on previous page not on default target url

Thanks Navneet

Former Member
0 Kudos

I need few more information. Can you pls tell me from which page you tried to login and provide your version as well. Because I have tried removing the URL attributes and by default it redirects to previous page.

Former Member
0 Kudos

Hi Jaykar,

I am using version 5.6 and I have remove siteid/language/currency from url. In product listing page,there is a link if user is not logged in then redirect it to login. After login it is landing on homepage I want previous page means in product listing page. It's working when I had not removed url encoding attributes.

Thanks

navneet

Former Member
0 Kudos

Navneet,

Can you please tell me are you able to land on product listing page after login? And if yes then please guide me also.

Regards, Sanket