本文整理汇总了PHP中UserHelper::encryptPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP UserHelper::encryptPassword方法的具体用法?PHP UserHelper::encryptPassword怎么用?PHP UserHelper::encryptPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserHelper
的用法示例。
在下文中一共展示了UserHelper::encryptPassword方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process()
{
$this->validate();
if (!$this->hasErrors()) {
if (($model = Yii::app()->getUser()->getModel()) !== null) {
return $model->saveAttributes(array('password' => UserHelper::encryptPassword($this->newPassword)));
}
}
return false;
}
示例2: authenticate
public function authenticate()
{
$user = User::model()->findByPk($this->username);
if ($user === null) {
$this->errorCode = self::ERROR_ID_NUMBER_INVALID;
} else {
if ($user->password !== UserHelper::encryptPassword($this->password)) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
} else {
$this->_id = $user->uid;
$this->errorCode = self::ERROR_NONE;
}
}
return !$this->errorCode;
}
示例3: beforeSave
public function beforeSave()
{
if (parent::beforeSave()) {
$this->email_address = strtolower($this->email_address);
if ($this->getIsNewRecord()) {
$this->password = UserHelper::encryptPassword($this->password);
$this->deleted = 0;
$this->datetime_created = new CDbExpression('now()');
} else {
$this->last_modified = new CDbExpression('now()');
}
return true;
}
return false;
}