andjelko
(Dragonlord888)
1
I class User
function rules
array('username, email, password', 'required'),
array('password', 'default',
'value'=>new CDbExpression(':password', array(':password'=>$this->hashPassword(':password') ) ),
'setOnEmpty'=>false, 'on'=>'insert,update'),
it doesn’t work!
can anyone help me?
abennouna
(Abennouna)
2
I wonder if rules allow such a use.
In any case, you can use beforeSave in your model to hash the password. There are many examples here and there.
Haensel
(Johannes)
3
bennouna is right, you can’t use the rules for that. Take a look at this wiki entry. Simple and useful: http://www.yiiframework.com/wiki/240/authenticating-against-phpass-hashes-with-yii