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

LogIn redirecting to home page instead of the referring page

Former Member
0 Kudos
1,305

When I go to /my-account without being authenticated, I'm taken to the login form and then, automatically, to /my-account after I login. However, a new page I have (let's just say it is /my-page) does not have the same effect. When I go to /my-page without being authenticated, I am taken to the login page and then, automatically to /shop-home (the default redirect URL) instead of /my-page.

Does anyone know how to enable a redirect similar to /my-account but for /my-page?

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member645853
Participant
0 Kudos

I commented login values in excludeRedirectUrlRequestMatcher bean and it worked fine for me.

VinayKumarS
Active Contributor
0 Kudos

i am not sure which reciepe you are using. i created b2b storefront. i see below code. here you have to modifiy the action which you want to call after successful authentication.

This code can be found in storefront/web/webroot/web-inf/config/spring-security-config.xml

 <bean id="loginAuthenticationSuccessHandler" class="de.hybris.platform.acceleratorstorefrontcommons.security.StorefrontAuthenticationSuccessHandler" >
         <property name="customerFacade" ref="customerFacade" />
         <property name="defaultTargetUrl" value="#{'responsive' == '${commerceservices.default.desktop.ui.experience}' ? '/' : '/my-account'}"/>
         <property name="useReferer" value="true"/>
         <property name="requestCache" ref="httpSessionRequestCache" />
         <property name="uiExperienceService" ref="uiExperienceService"/>
         <property name="cartFacade" ref="cartFacade"/>
         <property name="cartRestorationStrategy" ref="cartRestorationStrategy"/>
         <property name="forceDefaultTargetForUiExperienceLevel">
             <map key-type="de.hybris.platform.commerceservices.enums.UiExperienceLevel" value-type="java.lang.Boolean">
                 <entry key="DESKTOP" value="false"/>
                 <entry key="MOBILE" value="false"/>
             </map>
         </property>
         <property name="bruteForceAttackCounter" ref="bruteForceAttackCounter" />
         <property name="restrictedPages">
             <list>
                 <value>/login</value>
             </list>
         </property>
         <property name="listRedirectUrlsForceDefaultTarget">
             <list></list>
         </property>
     </bean>
Former Member
0 Kudos

This looks like the defaultTargetUrl is going to be either "/" or "/my-account". What I would like is to have the httpSessionRequestCache keep the original referrer and use it after login. That's not happening when I try to go to /my-page. I don't know why...