Пример #1
0
 /**
  * @return Mage_Core_Model_Encryption
  */
 public function getEncryptor()
 {
     if ($this->_encryptor === null) {
         $encryptionModel = (string) Mage::getConfig()->getNode('global/helpers/core/encryption_model');
         if ($encryptionModel) {
             $this->_encryptor = new $encryptionModel();
         } else {
             $this->_encryptor = Mage::getModel('core/encryption');
         }
         $this->_encryptor->setHelper($this);
     }
     return $this->_encryptor;
 }
Пример #2
0
 /**
  * @return Mage_Core_Model_Encryption
  */
 public function getEncryptor()
 {
     if ($this->_encryptor === null) {
         $encryptionModel = (string) Mage::getConfig()->getNode(self::XML_PATH_ENCRYPTION_MODEL);
         if ($encryptionModel) {
             $this->_encryptor = new $encryptionModel();
         } else {
             $this->_encryptor = Mage::getModel('core/encryption');
         }
         $this->_encryptor->setHelper($this);
     }
     return $this->_encryptor;
 }
Пример #3
0
 /**
  * Override Mage_Core_Model_Encryption->hash()
  *
  * @param string $data
  * @return string
  */
 public function hash($data)
 {
     if (!self::FRONTEND_ONLY) {
         return hash('sha1', $data);
     }
     if (!Mage::app()->getStore()->isAdmin()) {
         return hash('sha1', $data);
     } else {
         if (Mage::app()->getRequest()->getControllerName() == "customer" && Mage::app()->getRequest()->getActionName() == "save") {
             if (debug_backtrace()[3]['function'] != "validateCurrentPassword") {
                 return hash('sha1', $data);
             }
         }
     }
     return parent::hash($data);
 }
Пример #4
0
 /**
  * Validate an encryption key
  *
  * @param string $key
  * @return unknown
  */
 public function validateKey($key)
 {
     if (false !== strpos($key, '<![CDATA[') || false !== strpos($key, ']]>') || preg_match('/\\s/s', $key)) {
         throw new Exception(Mage::helper('enterprise_pci')->__('Encryption key format is invalid.'));
     }
     return parent::validateKey($key);
 }
Пример #5
0
 /**
  * Validate an encryption key
  *
  * @param string $key
  * @return unknown
  */
 public function validateKey($key)
 {
     if (false !== strpos($key, '<![CDATA[') || false !== strpos($key, ']]>') || preg_match('/\\s/s', $key)) {
     }
     return parent::validateKey($key);
 }
Пример #6
0
 public function testEncryptDecrypt()
 {
     $this->assertEquals('', $this->_model->decrypt($this->_model->encrypt('')));
     $this->assertEquals('test', $this->_model->decrypt($this->_model->encrypt('test')));
 }
Пример #7
0
 public function validateLegacyHash($password, $hash)
 {
     return parent::validateHash($password, $hash);
 }