我无法更新数据库中的值。下面是代码:
if($user = User::model()->findByAttributes(array('username'=>$verification->username)))
{
// Generating 8 random symbols for new password
$new_password = substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyz", 8)), 0, 8);
// Transfering password to MD5 hash with salt!
$new_password = md5('salt'.$new_password);
$user->password = $new_password;
if($user->save())
{...调试器显示值并将其替换(密码),但当您保存
如果($user->save()){
对最近的代码行进行错误和重置:
$this->呈现(‘遗忘’);
问题:
发布于 2014-06-03 21:27:25
最后一个注释是,如果表中没有repeat_password字段,则将其手工添加到模型中。(用户模型)。(实际上,您的表中不需要有这个字段。)
public $repeat_password然后,为字段定义规则。(例如,要求等等)
要获得验证错误,可以如下所示:
CVarDumper::dump($model->getErrors(),56789,true);https://stackoverflow.com/questions/24024082
复制相似问题