You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by BrettS <br...@gmail.com> on 2010/03/09 08:56:55 UTC

How To Change Security Redirect URL in OFBiz Shopping Cart?

Hi,

I want to change URL that security will redirect to when a user is not
logged in.

For example, if you hit the "Check out" link in the ecommerce shopping cart
before logging in, OFBiz will redirect you to the "checkLogin" URL. I
presume this is because of the setting "<security https="true"
auth="true"/>" in the "checkoutoptions" mapping in controller.xml. Can
someone tell me how to change this destination "checkLogin" URL to something
else please? Details as follows. 

I am creating an customized shopping cart for a particular set of users.
This shopping cart is a stripped down version of the standard cart and runs
in parallel with the standard cart. I have built this customized cart by
copying and modifying existing widgets and FTL files from the standard cart.
For example, I created this modified version of checkLogin that looks very
similar to the original:

<request-map uri="mcheckLogin" edit="false">
	<description>Verify a mymain user is logged in.</description>
	<security https="true" auth="false"/>
	<event type="java" path="org.ofbiz.securityext.login.LoginEvents"
invoke="storeCheckLogin"/>
	<response name="success" type="view" value="mymain"/>
	<response name="error" type="view" value="mlogin"/>
</request-map>

I also created this modified version of "checkoutoptions".

<request-map uri="mcheckoutoptions">
	<security https="true" auth="true"/>
	<event type="java" path="org.ofbiz.order.shoppingcart.CheckOutEvents"
invoke="setCheckOutPages"/>
	<response name="shippingaddress" type="view"
value="mcheckoutshippingaddress"/>
	<response name="shippingoptions" type="request"
value="msetOrderCurrencyAgreementShipDates"/>
	<response name="payment" type="request" value="setPoNumber"/>
	<response name="confirm" type="request" value="calcShipping"/>
	<response name="success" type="view" value="mcheckoutshippingaddress"/>
	<response name="error" type="request" value="mcheckouterror"/>
</request-map>

If the user is logged in, OFBiz will display shipping page. However if the
user is not logged in, OFBiz will redirect them to the standard "checkLogin"
URL which I don't want. I want OFBiz to go to my custom "mcheckLogin"
instead. Furthermore, if a user goes to the standard "checkoutoptions" URL,
I still want OFBiz to load the standard login page.

Any suggestions?

Thank you.

Regards Brett S
-- 
View this message in context: http://n4.nabble.com/How-To-Change-Security-Redirect-URL-in-OFBiz-Shopping-Cart-tp1585631p1585631.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: How To Change Security Redirect URL in OFBiz Shopping Cart?

Posted by BrettS <br...@gmail.com>.
Hi,

Eventually, I found the following line in RequestHandler.java determined
that checkLogin control was used if  auth="true" and user not logged in:

    requestMap = controllerConfig.requestMapMap.get("checkLogin");

So, I wrote some code to change "checkLogin" if the alternate shopping cart
was in use.

Regards

Brett S
-- 
View this message in context: http://n4.nabble.com/How-To-Change-Security-Redirect-URL-in-OFBiz-Shopping-Cart-tp1585631p1595957.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: How To Change Security Redirect URL in OFBiz Shopping Cart?

Posted by BrettS <br...@gmail.com>.
Hi Scott,

Thanks for your reply.

Unfortunately in my case, overriding the existing controller entry is not an
option.

The reason is, I need to keep the existing shopping cart unchanged and
running in parallel with the new shopping cart.

This is why I am going to the trouble of creating new controllers, widgets
and freemarker templates.

Regards Brett

> Hi Brett, 
> The easiest way to go is to just use the same URI in your custom component 
> which will override the existing controller entry. 
> Regards 
> Scott 
-- 
View this message in context: http://n4.nabble.com/How-To-Change-Security-Redirect-URL-in-OFBiz-Shopping-Cart-tp1585631p1587212.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: How To Change Security Redirect URL in OFBiz Shopping Cart?

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Hi Brett,

The easiest way to go is to just use the same URI in your custom component which will override the existing controller entry.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 9/03/2010, at 12:56 AM, BrettS wrote:

> 
> Hi,
> 
> I want to change URL that security will redirect to when a user is not
> logged in.
> 
> For example, if you hit the "Check out" link in the ecommerce shopping cart
> before logging in, OFBiz will redirect you to the "checkLogin" URL. I
> presume this is because of the setting "<security https="true"
> auth="true"/>" in the "checkoutoptions" mapping in controller.xml. Can
> someone tell me how to change this destination "checkLogin" URL to something
> else please? Details as follows. 
> 
> I am creating an customized shopping cart for a particular set of users.
> This shopping cart is a stripped down version of the standard cart and runs
> in parallel with the standard cart. I have built this customized cart by
> copying and modifying existing widgets and FTL files from the standard cart.
> For example, I created this modified version of checkLogin that looks very
> similar to the original:
> 
> <request-map uri="mcheckLogin" edit="false">
> 	<description>Verify a mymain user is logged in.</description>
> 	<security https="true" auth="false"/>
> 	<event type="java" path="org.ofbiz.securityext.login.LoginEvents"
> invoke="storeCheckLogin"/>
> 	<response name="success" type="view" value="mymain"/>
> 	<response name="error" type="view" value="mlogin"/>
> </request-map>
> 
> I also created this modified version of "checkoutoptions".
> 
> <request-map uri="mcheckoutoptions">
> 	<security https="true" auth="true"/>
> 	<event type="java" path="org.ofbiz.order.shoppingcart.CheckOutEvents"
> invoke="setCheckOutPages"/>
> 	<response name="shippingaddress" type="view"
> value="mcheckoutshippingaddress"/>
> 	<response name="shippingoptions" type="request"
> value="msetOrderCurrencyAgreementShipDates"/>
> 	<response name="payment" type="request" value="setPoNumber"/>
> 	<response name="confirm" type="request" value="calcShipping"/>
> 	<response name="success" type="view" value="mcheckoutshippingaddress"/>
> 	<response name="error" type="request" value="mcheckouterror"/>
> </request-map>
> 
> If the user is logged in, OFBiz will display shipping page. However if the
> user is not logged in, OFBiz will redirect them to the standard "checkLogin"
> URL which I don't want. I want OFBiz to go to my custom "mcheckLogin"
> instead. Furthermore, if a user goes to the standard "checkoutoptions" URL,
> I still want OFBiz to load the standard login page.
> 
> Any suggestions?
> 
> Thank you.
> 
> Regards Brett S
> -- 
> View this message in context: http://n4.nabble.com/How-To-Change-Security-Redirect-URL-in-OFBiz-Shopping-Cart-tp1585631p1585631.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.