本文整理汇总了PHP中BlowfishPasswordHasher::check方法的典型用法代码示例。如果您正苦于以下问题:PHP BlowfishPasswordHasher::check方法的具体用法?PHP BlowfishPasswordHasher::check怎么用?PHP BlowfishPasswordHasher::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlowfishPasswordHasher
的用法示例。
在下文中一共展示了BlowfishPasswordHasher::check方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeFilter
public function beforeFilter()
{
if ($this->request->is('ajax')) {
$this->response->type("application/json");
$this->layout = "ajax";
} elseif ($this->request->params['controller'] != 'installers' && !$this->__isInstalled()) {
$this->redirect(array('controller' => 'installers', 'action' => 'index'));
} elseif ($this->request->params['controller'] == 'installers' && $this->__isInstalled()) {
$this->Session->setFlash(__('Sonerezh is already installed. Remove or rename app/Config/database.php to run the installation again.'), 'flash_info');
$this->redirect(array('controller' => 'songs', 'action' => 'index'));
}
if ($this->__isInstalled() && !$this->Auth->user() && $this->Cookie->check('auth')) {
$this->loadModel('User');
$cookie = $this->Cookie->read('auth');
$authCookie = explode(':', $cookie);
$user = $this->User->find('first', array('conditions' => array('id' => $authCookie[0])));
$passwordHasher = new BlowfishPasswordHasher();
if ($passwordHasher->check($user['User']['email'], $authCookie[1]) && $passwordHasher->check($user['User']['password'], $authCookie[2])) {
unset($user['User']['password']);
$this->Auth->login($user['User']);
$this->Cookie->write('auth', $this->Cookie->read('auth'));
} else {
$this->Cookie->delete('auth');
}
}
if (!$this->request->is('ajax') && $this->Auth->user()) {
$this->loadModel('Setting');
$setting = $this->Setting->find('first', array('fields' => array('sync_token')));
$this->set('sync_token', $setting['Setting']['sync_token']);
}
$this->__setLanguage();
}
示例2: comparePassword
public function comparePassword($id = null, $password = null)
{
$passwordHasher = new BlowfishPasswordHasher();
$this->id = $id;
$hashPasswordData = $this->field('password');
return $passwordHasher->check($password, $hashPasswordData);
}
示例3: checkCurrentPassword
public function checkCurrentPassword($current_password)
{
$this->id = AuthComponent::user('id');
$saved_password = $this->field('password');
$hasher = new BlowfishPasswordHasher();
return $hasher->check($current_password, $saved_password);
}
示例4: login
public function login($user, $pass)
{
$passwordHasher = new BlowfishPasswordHasher();
$x = $this->find('first', array('conditions' => array('User.email' => $user)));
//debug($x);
//exit;
if (!empty($x)) {
return $passwordHasher->check($pass, $x['User']['clave']);
} else {
return false;
}
}
示例5: checkPassword
/**
* Function to check the users old password is correct
*
* @param array $data The users data
* @return booleen true is it matches, false otherwise
*/
public function checkPassword($check)
{
$value = array_shift($check);
if (strlen($value) == 0) {
return true;
}
// if no userId is set
if (empty($this->data['User']['id'])) {
return false;
}
$this->contain();
$user = $this->findById($this->data['User']['id'], 'password');
if (!$user) {
return false;
}
$passwordHasher = new BlowfishPasswordHasher();
return $passwordHasher->check($value, $user['User']['password']);
}
示例6: checkPassword
/**
* 現在のパスワードと確認パスワードが一致するかを判定する
*
* @return boolean
*/
public function checkPassword()
{
$passwordHasher = new BlowfishPasswordHasher();
$current_pass = $this->User->getPasswordById($this->Auth->user('id'));
// パスワードの正誤判定
if ($passwordHasher->check($this->request->data['User']['old_password'], $current_pass)) {
return true;
} else {
return false;
}
}
示例7: matchCurrentPassword
/**
* Validation rule
* Check value is equal current password
* @author thientd
*/
public function matchCurrentPassword($check)
{
$check = array_values($check);
$check = $check[0];
if (!$check) {
return empty($this->data[$this->name]['password']);
}
if (empty($this->id)) {
return false;
}
$user = $this->find('first', array('fields' => array('password'), 'conditions' => array($this->primaryKey => $this->id), 'recursive' => -1));
if (!$user) {
return false;
}
App::uses('BlowfishPasswordHasher', 'Controller/Component/Auth');
$passwordHasher = new BlowfishPasswordHasher();
return $passwordHasher->check($check, $user[$this->alias]['password']);
}