nemo
(Nemoneel)
March 10, 2010, 3:02pm
1
I want to change password using this function in my module if user want to change their password
public $hash=‘md5’;
public function encrypting($string="") {
$hash = Yii::app()->User->hash;
if ($hash=="md5")
return md5($string);
if ($hash=="sha1")
return sha1($string);
else
return hash($hash,$string);
}
problem is when I click submit then I got this error
CException
Description
CWebUser does not have a method named "encrypting".
Source File
have any idea?
andy_s
(Arekandrei)
March 10, 2010, 7:01pm
2
CWebUser really doesn’t have a method named “encrypting”
I guess it’s a method of your module (probably UserModule), so you should call it like that:
// In module's controllers:
$hash = $this->module->encrypting($string);
// From other controllers (probably you won't need this)
$hash = Yii::app()->getModule('User')->encrypting($string);
nemo
(Nemoneel)
March 10, 2010, 7:41pm
3
andy_s:
CWebUser really doesn’t have a method named “encrypting”
I guess it’s a method of your module (probably UserModule), so you should call it like that:
// In module's controllers:
$hash = $this->module->encrypting($string);
// From other controllers (probably you won't need this)
$hash = Yii::app()->getModule('User')->encrypting($string);
I got this error
Fatal error: Call to a member function encrypting() on a non-object in controllers/SiteController.php on line 176
176 line is
$find->password = Yii::app()->getModule(‘User’)->encrypting($string);
Onman
(O Rijkers)
March 10, 2010, 11:01pm
4
You do a getModule(‘User’) --> User is written with a Capital U
Should it be getModule(‘user’)? --> User is written with a lowercase u