diff --git a/CHANGELOG.md b/CHANGELOG.md index 75a605225..d473b567f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -386,3 +386,7 @@ Magento CE 1.8+ or EE 1.13+, see [these instructions](https://github.com/nexcess * [#796] Ignore additional GET Parameters in Varnish Cache via Configuration (@thampe) * [#626] Fix for dummy blocks not working (@jeroenvermeulen) * [#719) Replace connect20/nexcessnet_turpentine package in composer.json (@ihor-sviziev) + +### RELEASE-0.6.3 + * [#499] Use rewrite instead of local Session model for form key handling (@eth8505) + diff --git a/app/code/community/Nexcessnet/Turpentine/Model/Core/Session.php b/app/code/community/Nexcessnet/Turpentine/Model/Core/Session.php new file mode 100644 index 000000000..7b2afa444 --- /dev/null +++ b/app/code/community/Nexcessnet/Turpentine/Model/Core/Session.php @@ -0,0 +1,53 @@ +init('core', $name); + } + + /** + * Retrieve Session Form Key + * + * @return string A 16 bit unique key for forms + */ + public function getFormKey() + { + if (Mage::registry('replace_form_key') && + !Mage::app()->getRequest()->getParam('form_key', false)) { + // flag request for ESI processing + Mage::register('turpentine_esi_flag', true, true); + return '{{form_key_esi_placeholder}}'; + } else { + return parent::getFormKey(); + } + } + + public function real_getFormKey() + { + if (!$this->getData('_form_key')) { + $this->setData('_form_key', Mage::helper('core')->getRandomString(16)); + } + return $this->getData('_form_key'); + } +} diff --git a/app/code/community/Nexcessnet/Turpentine/etc/config.xml b/app/code/community/Nexcessnet/Turpentine/etc/config.xml index d50d43b0c..f67896000 100644 --- a/app/code/community/Nexcessnet/Turpentine/etc/config.xml +++ b/app/code/community/Nexcessnet/Turpentine/etc/config.xml @@ -20,7 +20,7 @@ - 0.6.2 + 0.6.3 @@ -136,6 +136,11 @@ Nexcessnet_Turpentine_Model + + + Nexcessnet_Turpentine_Model_Core_Session + + diff --git a/app/code/local/Mage/Core/Model/Session.php b/app/code/local/Mage/Core/Model/Session.php deleted file mode 100644 index 4c701738f..000000000 --- a/app/code/local/Mage/Core/Model/Session.php +++ /dev/null @@ -1,69 +0,0 @@ -init('core', $name); - } - - /** - * Retrieve Session Form Key - * - * @return string A 16 bit unique key for forms - */ - public function getFormKey() - { - if (Mage::registry('replace_form_key') && - !Mage::app()->getRequest()->getParam('form_key', false)) { - // flag request for ESI processing - Mage::register('turpentine_esi_flag', true, true); - return '{{form_key_esi_placeholder}}'; - } else { - return $this->real_getFormKey(); - } - } - - public function real_getFormKey() - { - if (!$this->getData('_form_key')) { - $this->setData('_form_key', Mage::helper('core')->getRandomString(16)); - } - return $this->getData('_form_key'); - } -}