Jump to content
Larry Ullman's Book Forums

Password Hash Method In Book Does Not Work, Got Error.


Edmond
 Share

Recommended Posts

I followed the book in page 208 -209, chapter 9.

 

But when I tested it, I got this error, I looked up in the documentation, this method exists... 

 

 

CException

CSecurityManager and its behaviors do not have a method or closure named "computeHMAC".

Link to comment
Share on other sites

thankyou Larry, the code:

 

------------config/main.php

    // application components
    'components'=>array(
        'user'=>array(
            // enable cookie-based authentication
            'allowAutoLogin'=>true,
        ),
        
        'securityManager' => array(
        'hashAlgorithm' => 'sha256',
        'validationKey' => 'lvkj23mn5;9 cjl;sd;ij25KJE5r'),

        
--------------model
    protected function beforeSave(){
        $this->password = Yii::app()->securityManager->computeHMAC($this->password);
        return parent::beforeSave();
    }

--------------ERROR
CException

CSecurityManager and its behaviors do not have a method or closure named "computeHMAC".

C:\wamp\www\yii-1-1-13\framework\base\CComponent.php(265)
265         throw new CException(Yii::t('yii','{class} and its behaviors do not have a method or closure named "{name}".',

Link to comment
Share on other sites

 Share

×
×
  • Create New...