本文整理汇总了PHP中Illuminate\Contracts\Auth\Authenticatable::getAuthPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP Authenticatable::getAuthPassword方法的具体用法?PHP Authenticatable::getAuthPassword怎么用?PHP Authenticatable::getAuthPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Auth\Authenticatable
的用法示例。
在下文中一共展示了Authenticatable::getAuthPassword方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateCredentials
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(UserContract $user, array $credentials)
{
$plain = $credentials['password'];
$options = array();
if ($user instanceof User) {
$options['salt'] = $user->salt;
$options['byte_size'] = strlen($user->getAuthPassword());
}
return $this->hasher->check($plain, $user->getAuthPassword(), $options);
}
示例2: validateCredentials
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(UserContract $user, array $credentials)
{
$plain = $credentials['password'];
$legacyHasher = $user->getAuthObject();
if ($legacyHasher !== false) {
if (!$legacyHasher->check($plain, $user->getAuthPassword())) {
return false;
}
$user->password = $this->hasher->make($plain);
$user->password_legacy = null;
$user->save();
return true;
}
return $this->hasher->check($plain, $user->getAuthPassword());
}
示例3: validateCredentials
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(Authenticatable $user, array $credentials)
{
$plain = $credentials['password'];
$laravel = $this->hasher->check($plain, $user->getAuthPassword());
if ($laravel) {
return true;
}
$django = $this->hasher->checkForDjango($plain, $user->getAuthPassword());
if ($django) {
if (config('auth.rehash_django', true)) {
$this->updatePassword($user, $plain);
}
return true;
}
return false;
}
示例4: validateCredentials
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(Authenticatable $user, array $credentials)
{
if (!isset($credentials['password'])) {
return false;
}
return $user->getAuthPassword() === $credentials['password'];
}
示例5: validateCredentials
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(Authenticatable $user, array $credentials)
{
// $is_valid = $this->model->where('Username', '=', $credentials['Username'])->where('Password', '=', $credentials['Password'])->first() != null;
$is_valid = $user->Username == $credentials['Username'] && $this->hasher->check($credentials['Password'], $user->getAuthPassword());
return $is_valid;
// $plain = $credentials['password'];
// return $this->hasher->check($plain, $user->getAuthPassword());
}
示例6: validateCredentials
/**
* @param Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(Authenticatable $user, array $credentials)
{
if ($user->type == 'local') {
$plain = $credentials['password'];
return $this->hasher->check($plain, $user->getAuthPassword());
}
return true;
}
示例7: validateCredentials
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(Authenticatable $user, array $credentials)
{
if ($user instanceof CustomKeyAuthenticable) {
$method = 'get' . ucfirst($user->getAuthKeyName());
} else {
$method = 'getEmail';
}
return app('hash')->check($credentials['password'], $user->getAuthPassword()) && trim(strtolower($credentials['email'])) === trim(strtolower($user->{$method}()));
}
示例8: validateCredentials
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Auth\UserInterface $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(\Illuminate\Contracts\Auth\Authenticatable $user, array $credentials)
{
$plain = $credentials['password'];
return $this->hasher->check($plain, $user->getAuthPassword());
}
示例9: validateCredentials
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
*
* @return bool
*/
public function validateCredentials(AuthenticatableContract $user, array $credentials)
{
return $this->hasher->check($credentials['password'], $user->getAuthPassword());
}
示例10: validateCredentials
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(Authenticatable $user, array $credentials)
{
$plain = $credentials['password'];
return $this->hasher->check($plain, $this->hasher->make($user->getAuthPassword()));
}
示例11: validateCredentials
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(Authenticatable $user, array $credentials)
{
$password = $credentials[$this->getPasswordField()];
return $this->hasher->check($password, $user->getAuthPassword());
}
示例12: validateCredentials
public function validateCredentials(UserContract $user, array $credentials)
{
$userPass = $user->getAuthPassword();
$pass = $credentials['password'];
return password_verify($pass, $userPass);
}
示例13: validateCredentials
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
*
* @return bool
*/
public function validateCredentials(Authenticatable $user, array $credentials)
{
$pwmatch = FALSE;
$hash = $user->getAuthPassword();
if ($this->hash_password) {
if ($this->log_logins) {
Log::debug('login.validatecreds.hashpw', ['username_clean' => strtolower($credentials['username'])]);
}
//Check if hash is a bcryp 2 hash, then use bcrypt2
if (strncmp($hash, '$2y$10$', 7) == 0) {
$pwmatch = Hash::check($credentials['password'], $hash);
if ($this->log_logins) {
Log::debug('login.validatecreds.newhash', ['username_clean' => strtolower($credentials['username'])]);
}
} else {
$passwordhash = new PasswordHash();
$pwmatch = $passwordhash->phpbb_check_hash($credentials['password'], $user->getAuthPassword());
if ($this->log_logins) {
Log::debug('login.validatecreds.oldhash', ['username_clean' => strtolower($credentials['username'])]);
}
}
} else {
if ($this->log_logins) {
Log::debug('login.validatecreds.nohash', ['username_clean' => strtolower($credentials['username'])]);
}
$pwmatch = $credentials['password'] == $hash;
}
if ($user->username_clean == strtolower($credentials['username']) && $pwmatch == TRUE) {
if ($this->log_logins) {
Log::debug('login.validatecreds.success', ['username_clean' => strtolower($credentials['username'])]);
}
return TRUE;
}
if ($this->log_logins) {
Log::debug('login.validatecreds.fail', ['username_clean' => strtolower($credentials['username'])]);
}
return FALSE;
}
示例14: validateCredentials
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(UserContract $user, array $credentials)
{
$plain = $credentials['password'];
return $this->hasher->check($plain, $user->getAuthPassword());
}
示例15: validateCredentials
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(Authenticatable $user, array $credentials)
{
$plain = $credentials['password'];
if ($this->hasher->check($plain, $user->getAuthPassword())) {
// $user->last_login_time = Carbon::now();
// $user->save();
return true;
}
return false;
}