Пример #1
0
 /**
  * Check user password
  *
  * @param Authenticatable $user
  * @param array $credentials
  * @return bool
  */
 public function validateCredentials(Authenticatable $user, array $credentials)
 {
     $credentials['password'] = mysqlHash($credentials['password']);
     return $user->getAuthPassword() == $credentials['password'];
 }
Пример #2
0
 /**
  * Change password
  *
  * @param array $data
  * @param $user
  * @return bool
  * @throws \Metin2CMS\Exceptions\Core\PasswordFailedException
  */
 public function password(array $data, $user)
 {
     $hashed_pass = mysqlHash($data['old_password']);
     if ($hashed_pass !== $this->account->authPassword($user->id)) {
         throw new PasswordFailedException('Your old password is incorrect.');
     }
     $this->events->fire('account.password.before', [$data]);
     $wasChanged = $this->account->changePassword($user->login, mysqlHash($data['new_password']));
     if ($wasChanged) {
         $this->meta->set($user->id, 'password_last', Carbon::now());
         $this->events->fire('account.password.after', [$data]);
     }
     return $wasChanged;
 }
Пример #3
0
 /**
  * Let Eloquent take care of password field. Using game default hash method.
  *
  * @param $value
  */
 public function setPasswordAttribute($value)
 {
     $this->attributes['password'] = mysqlHash($value);
 }