本文整理汇总了PHP中UserModule::encryptPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModule::encryptPassword方法的具体用法?PHP UserModule::encryptPassword怎么用?PHP UserModule::encryptPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModule
的用法示例。
在下文中一共展示了UserModule::encryptPassword方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: verifyPassword
/**
* Phương thức verifyPassword($attribute, $params) dùng để xác thực mật khẩu của user
*
* @param type $attribute
* @param type $params
*/
public function verifyPassword($attribute, $params)
{
$strPassword = UserModule::encryptPassword($this->verifyPassword, $this->__user->saltkey);
if ($strPassword != $this->__user->password) {
$this->addError('verifyPassword', UserModule::t('The password you gave is incorrect.'));
}
}
示例2: authenticate
/**
* Phương thức authenticate() dùng để xác thực username và password của User có đúng không
*
* @return boolean whether authentication succeeds.
*/
public function authenticate()
{
//$record = User::model()->findByAttributes(array('username'=>$this->username));
if (strpos($this->username, "@")) {
$record = User::model()->notsafe()->findByAttributes(array('email' => $this->username));
} else {
$record = User::model()->notsafe()->findByAttributes(array('username' => $this->username));
}
if ($record === null) {
$this->errorCode = self::ERROR_USERNAME_INVALID;
} else {
if ($record->password !== UserModule::encryptPassword($this->password, $record->saltkey)) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
} else {
$this->_id = $record->id;
$this->setState('superuser', $record->superuser);
$this->errorCode = self::ERROR_NONE;
}
}
return !$this->errorCode;
}
示例3: createCodeActivation
/**
* Phương thức dùng để tạo ra mã activate code
*/
public function createCodeActivation()
{
$codeActivation = UserModule::encryptPassword(microtime(), UserModule::createSalt());
$this->activkey = $codeActivation;
return $codeActivation;
}