studioforty9-dev / Recaptcha

Magento Module for the most recent version of Google reCAPTCHA. (This module is no longer actively supported)
BSD 3-Clause "New" or "Revised" License
50 stars 45 forks source link

Spotted this didn't work on contact form so we had to make further mo… #22

Closed gazjoy closed 8 years ago

gazjoy commented 8 years ago

Spotted this didn't work on contact form so we had to make further mods to check the routes slightly differently.

Feel free to merge it if you think its right, works for our purposes.

eoghanobrien commented 8 years ago

Hey,

Thanks for the contribution, one thing to note here, a contact form can be, and often is, placed on other pages, usually CMS pages. By locking the display logic down like you've done, people who like to add their contact form to the sidebar or into the content area of their site would be unable to do so.

It looks like I'll need to revert it back to how it was before, where you can override the isAllowed method like so:

    <reference name="content">
      <block type="core/template" name="contactForm" template="contacts/form.phtml">
        <action method="setFormAction"><value>/contacts/index/post</value></action>
        <block type="studioforty9_recaptcha/explicit" name="studioforty9.recaptcha.explicit" template="studioforty9/recaptcha/explicit.phtml">
          <action method="setAllow"><value>true</value></action>
        </block>
      </block>
    </reference>

I'll add the code later today and push but since your PR failed the unit tests, I'll probably close this and re-implement locally.

Thanks, Eoghan