Customer Registration Magento "Honey Pot" captcha

I thought I had this sorted, but I ran into a problem. I want to add "Honey Pot" to the client registration form, since this unfamiliar method involves hiding text input using CSS and assumes that the average bot wants to fill it. People, however, will not see the field so that it needs to be confirmed as empty.

In Magento, I created a new module by adding the following to the config.xml file:

<global>
    <fieldsets>
        <customer_account>
            <honeytrap><create>1</create><update>1</update></honeytrap>
        </customer_account>
    </fieldsets>
    <models>
        <customer>
            <rewrite>
                <customer>MyStore_Honeytrap_Model_Customer</customer>
            </rewrite>
        </customer>
    </models>
</global>

, , . , , line 278 AccountController.php extractData() . Magento, - , extractData()?

, , , , , , , , -, Entity, , ( ).

, , , , - , .

EDIT: @gordon-knoppe :

public function check_trap(Varien_Event_Observer $observer)
{
    $event = $observer->getEvent();
    $post = $event->getControllerAction()->getRequest()->getPost();

    // Check Honeytrap is empty
    if (Zend_Validate::is( trim($post['fname']) , 'NotEmpty')) 
    {
        $customerHelper = Mage::helper('customer');
        $error = $customerHelper->__('A problem has occured with your registration.');
        Mage::getModel('customer/session')->addError($error);

        Mage::app()->getResponse()
            ->setRedirect(Mage::getUrl('customer/account', array('_secure' => true)))
            ->sendResponse();
        exit;
    }
}

config.xml:

    <events>
        <controller_action_predispatch_customer_account_createpost>
            <observers>
                <mystore_honeytrap_observer>
                    <type>singleton</type>
                    <class>Mystore_Honeytrap_Model_Observer</class>
                    <method>check_trap</method>
                </mystore_honeytrap_observer>
            </observers>
        </controller_action_predispatch_customer_account_createpost>
    </events>
+3
1

(controller_action_predispatch_*), , , , , - .

+3

All Articles