Page 1 of 1

Help on csrfToken

Posted: Sun Dec 09, 2012 10:56 pm
by pokemon007
Don't know what I did, somehow it started throwing following error when I access account mgr related pages:

Code: Select all

org.springframework.beans.NotReadablePropertyException: Invalid property 'csrfToken' of bean class [org.broadleafcommerce.core.web.controller.account.UpdateAccountForm]: Bean property 'csrfToken' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
   org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:729)
   org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:721)
   org.springframework.validation.AbstractPropertyBindingResult.getActualFieldValue(AbstractPropertyBindingResult.java:99)


Looking at the backing form object, org.broadleafcommerce.core.web.controller.account.UpdateAccountForm, it doesn't have csrfToken property. I must have messed something up that broke it. But how does this work if the backing form doesn't have a field that the HTML references?

Thank you in advance!

-Charlie

Re: Help on csrfToken

Posted: Sun Dec 09, 2012 11:53 pm
by phillipuniverse
On all of your <form tag declarations, use <blc:form instead.

Re: Help on csrfToken

Posted: Mon Dec 10, 2012 5:12 am
by pokemon007
Thank you for your reply. I've tried it, but it doesn't work. Maybe my code is out of sync? I started with 2.0.0-M1-6 and moved to 2.0.1-GA a few weeks ago. I haven't updated those html files. I guess the newer version it refers to now has this property moved to a processor? If so I'll need to update those html files.

Thank you!

-Charlie

Re: Help on csrfToken

Posted: Mon Dec 10, 2012 3:27 pm
by pokemon007
[Resolved]. csrfToken removed from all files as it's generated by the form processor now.

Thank you for pointing me to the right direction!

-Charlie

Re: Help on csrfToken

Posted: Mon Dec 10, 2012 5:32 pm
by phillipuniverse
Yup, that's the fix. Also, this property is really just used in a filter and not on the backing form objects. See CsrfFilter for more info. In some of the later point releases of 2.0 (not sure if 2.0.1 has it) you can also specify some excluded URLs from attempting to do CSRF validation. This is useful for things like payment gateways who usually send a POST back to your application at some URL that you specify; having a CSRF token wouldn't make sense there.

Re: Help on csrfToken

Posted: Sun Dec 16, 2012 8:32 pm
by pokemon007
Got it. So far without the treatment authorize.net posting back seems working fine at least for payment process and order confirmation.

Thank you for the tip.
-Charlie