diff --git a/app/code/community/Hackathon/HoneySpam/Exception.php b/app/code/community/Hackathon/HoneySpam/Exception.php new file mode 100644 index 0000000..eb19de0 --- /dev/null +++ b/app/code/community/Hackathon/HoneySpam/Exception.php @@ -0,0 +1,11 @@ +_resultCallback = self::RESULT_REDIRECT; + $this->_resultCallbackParams = [$path, $arguments]; + return $this; + } +} diff --git a/app/code/community/Hackathon/HoneySpam/Model/Observer.php b/app/code/community/Hackathon/HoneySpam/Model/Observer.php index 740e340..23c8631 100644 --- a/app/code/community/Hackathon/HoneySpam/Model/Observer.php +++ b/app/code/community/Hackathon/HoneySpam/Model/Observer.php @@ -27,7 +27,8 @@ class Hackathon_HoneySpam_Model_Observer { /** * call rules - * @throws Mage_Core_Controller_Varien_Exception + * + * @throws Hackathon_HoneySpam_Exception */ public function checkHoneypotCustomerAccountCreatepost() { @@ -57,7 +58,8 @@ public function checkHoneypot() /** * validate honeypot field - * @throws Mage_Core_Controller_Varien_Exception + * + * @throws Hackathon_HoneySpam_Exception */ protected function _checkHoneypot() { @@ -65,15 +67,16 @@ protected function _checkHoneypot() if ($helper->isHoneypotFilled()) { $helper->log('Honeypot Input filled. Aborted.', Zend_Log::WARN); - $e = new Mage_Core_Controller_Varien_Exception(); - $e->prepareForward('index', 'error', 'honeyspam'); + $e = new Hackathon_HoneySpam_Exception(); + $e->prepareRedirect('honeyspam/error/index'); throw $e; } } /** * validate time - * @throws Mage_Core_Controller_Varien_Exception + * + * @throws Hackathon_HoneySpam_Exception */ protected function _checkTimestamp() { @@ -85,8 +88,8 @@ protected function _checkTimestamp() ) { $helper->log('Honeypot Timestamp filled. Aborted.', Zend_Log::WARN); - $e = new Mage_Core_Controller_Varien_Exception(); - $e->prepareForward('index', 'error', 'honeyspam'); + $e = new Hackathon_HoneySpam_Exception(); + $e->prepareRedirect('honeyspam/error/index'); throw $e; } } @@ -101,7 +104,8 @@ public function checkHoneypotCustomerAccountCreate() /** * Invoke indexing - * @throws Mage_Core_Controller_Varien_Exception + * + * @throws Hackathon_HoneySpam_Exception */ protected function _indexLoginParams() { @@ -110,8 +114,8 @@ protected function _indexLoginParams() if ($return >= $helper->getSpamIndexLevel()) { $helper->log("Honeypot spam index at $return. Aborted.", Zend_Log::WARN); - $e = new Mage_Core_Controller_Varien_Exception(); - $e->prepareForward('index', 'error', 'honeyspam'); + $e = new Hackathon_HoneySpam_Exception(); + $e->prepareRedirect('honeyspam/error/index'); throw $e; } }