本文整理匯總了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;
}