本文整理汇总了PHP中PasswordHash::_getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP PasswordHash::_getInstance方法的具体用法?PHP PasswordHash::_getInstance怎么用?PHP PasswordHash::_getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PasswordHash
的用法示例。
在下文中一共展示了PasswordHash::_getInstance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restorePassword
/**
* @param string $content
* @return $this
*/
public function restorePassword($content = null)
{
$t = Token::_getInstance();
if (!is_null($content)) {
$t->_get(array('Content' => $content, 'Type' => 'restorePassword'))->_eq()->__($this->_('token', false));
if ($this->countErrors() || is_null($this->_('token'))) {
return $this->addError('password restoration', 0);
}
$this->_get($this->_('token')['UserID']);
if (!input('json')) {
return $this;
}
if ($this->_upsert(array('Email' => $this->_result['Email'], 'Password' => PasswordHash::_getInstance()->create_hash(input('password')), 'FirstName' => $this->_result['FirstName'], 'LastName' => $this->_result['LastName'], 'RoleID' => $this->_result['RoleID']))->countErrors()) {
return $this;
}
$t->_drop();
return $this->result(Lang::_getInstance()->getValue('passwordReset', 'User'));
}
if (!input('json')) {
return $this->result(array());
}
$email = input('email');
if ($this->_get(array('Email' => $email, 'Active' => true))->_eq()->countErrors() || empty($this->_result)) {
return $this->addError('password restoration', 1);
}
$t->_upsert(array('Content' => $t->_generate(), 'Type' => 'restorePassword', 'UserID' => $this->_result['ID']))->__($this->_('token', false));
Email::_getInstance()->send($email, 'restorePassword', array('token' => $this->_('token')['Content']));
if ($this->countErrors()) {
$t->_drop();
return $this;
}
return $this->result(Lang::_getInstance()->getValue('passwordRestorationSent', 'User'));
}