public static function auth($email, $pass)
 {
     // Get user by email.
     if (!($user = Users::get_by_email($email))) {
         return false;
     }
     // Make sure the password is correct.
     if (Hash::check($pass, $user['UsersPassword'])) {
         self::_do_user($user);
         Session::put('AccessToken', Users::get_access_token($user['UsersId']));
         // Get the default AccountId
         \AcctsUsersLu::set_col('AcctsUsersLuUserId', $user['UsersId']);
         \AcctsUsersLu::set_order('AcctsUsersLuAcctId');
         \AcctsUsersLu::set_limit(1);
         $lp = \AcctsUsersLu::get();
         // Make sure we have at least one account.
         if (!isset($lp[0])) {
             return false;
         }
         // Set default account
         Session::put('AccountId', $lp[0]['AcctsUsersLuAcctId']);
         return true;
     }
     return false;
 }
 /**
  * Attempt to log a user into the application.
  *
  * @param  array  $arguments
  * @return void
  */
 public function attempt($arguments = array())
 {
     $user = $this->get_user($arguments['username']);
     // This driver uses a basic username and password authentication scheme
     // so if the credentials mmatch what is in the database we will just
     // log the user into the application and remember them if asked.
     $password = $arguments['password'];
     if (!is_null($user) and Hash::check($password, $user->password)) {
         return $this->login($user->id, array_get($arguments, 'remember'));
     }
     return false;
 }
 /**
  * Attempt to log a user into the application.
  *
  * @param  array $arguments
  * @return void
  */
 public function attempt($arguments = array())
 {
     $user = $this->get_user($arguments);
     // If the credentials match what is in the database we will just
     // log the user into the application and remember them if asked.
     $password = $arguments['password'];
     $password_field = Config::get('auth.password', 'password');
     if (!is_null($user) and Hash::check($password, $user->{$password_field})) {
         return $this->login($user->UsersId, array_get($arguments, 'remember'));
     }
     return false;
 }
 /**
  * Implements IOAuth2Storage::checkClientCredentials().
  *
  */
 public function checkClientCredentials($client_id, $client_secret = NULL)
 {
     try {
         $client = \OAuth2Server\Models\Client::where_client_id($client_id)->first();
         if ($client_secret === NULL) {
             return $client !== FALSE;
         }
         return \Laravel\Hash::check($client_secret . $client_id, $client->client_secret);
     } catch (PDOException $e) {
         $this->handleException($e);
     }
 }
Exemple #5
0
 /**
  * Attempt to log a user into the application.
  *
  * @param  array  $arguments
  * @return void
  */
 public function attempt($arguments = array())
 {
     $username = Config::get('auth.username');
     $user = $this->model()->where($username, $arguments[$username])->first();
     // This driver uses a basic username and password authentication scheme
     // so if the credentials match what is in the database we will just
     // log the user into the application and remember them if asked.
     $password = $arguments['password'];
     if (!is_null($user) and Hash::check($password, $user->password)) {
         return $this->login($user->_id, array_get($arguments, 'remember'));
     }
     return false;
 }
 /**
  * Attempt to log a user into the application.
  *
  * @param  array $arguments
  * @return void
  */
 public function attempt($arguments = array())
 {
     $user = $this->model()->where(function ($query) use($arguments) {
         $username = Config::get('admin::auth.username');
         $query->where($username, '=', $arguments['username']);
         foreach (array_except($arguments, array('username', 'password', 'remember')) as $column => $val) {
             $query->where($column, '=', $val);
         }
     })->first();
     // If the credentials match what is in the database we will just
     // log the user into the application and remember them if asked.
     $password = $arguments['password'];
     $password_field = Config::get('admin::auth.password', 'password');
     if (!is_null($user) and Hash::check($password, $user->{$password_field})) {
         return $this->login($user->get_key(), array_get($arguments, 'remember'));
     }
     return false;
 }
 public function attempt($arguments = array())
 {
     $user = $this->get_user($arguments);
     $password = $arguments['password'];
     $password_field = Config::get('auth.password', 'password');
     if (!is_null($user) and Hash::check($password, $user->{$password_field})) {
         return $this->login($user->id, array_get($arguments, 'remember'));
     }
     return false;
 }