I wanted to remove some token from add to cart forms even for anonymous users and I realised that eventhough anonymous (for now) is the only role configured for authcache, I wasn't able to configure that role to remove form token.

Looking in the code I realised this was somehow by designed, but I wonder if that should be like that or maybe some decision along the way carried away? I want to have the flexibility of doing such a thing, I am not sure why a module like this one should simply not allow it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hanoii created an issue. See original summary.

hanoii’s picture

After looking at code it seems that the most sensible way is to simply remove the #members_only feature all along. It's only really used within authcache_form and I rather allow for flexibility that something else.

Attached is a patch that removes all of this.

I project-wise searched and it's only used on those places.

Status: Needs review » Needs work

The last submitted patch, 2: authcache-remove_members_only_widget-2750043-2.patch, failed testing.

The last submitted patch, 2: authcache-remove_members_only_widget-2750043-2.patch, failed testing.

The last submitted patch, 2: authcache-remove_members_only_widget-2750043-2.patch, failed testing.

The last submitted patch, 2: authcache-remove_members_only_widget-2750043-2.patch, failed testing.

znerol’s picture

There should not be any tokens on any forms built for anonymous users. See drupal_prepare_form().

Do you really see form_token added to a form for anonymous users on your site? Hint, do not confuse CSRF tokens with the form_build_id which is required for Ajax forms. The latter is also added for anonymous users.

hanoii’s picture

Ah, will investigate further, I assumed as I remember doing something like this while implementing a custom cache solution with nginx. Thanks a lot for the quick reply, will follow up with a few other patches probably. Thanks!

znerol’s picture

Status: Needs work » Postponed (maintainer needs more info)
znerol’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)