Esempio n. 1
0
 /**
  * @param $clientId
  * @param $username
  * @param $password
  *
  * @return array|boolean
  */
 protected function checkUserCredentials($clientId, $username, $password)
 {
     try {
         if (null === ($client = $this->app['repo.api-applications']->findByClientId($clientId))) {
             return false;
         }
         $this->setClient($client);
         $usrId = $this->app['auth.native']->getUsrId($username, $password, Request::createFromGlobals());
         if (!$usrId) {
             return false;
         }
         if (null === ($user = $this->app['repo.users']->find($usrId))) {
             return false;
         }
         $account = $this->updateAccount($user);
         return ['redirect_uri' => $this->client->getRedirectUri(), 'client_id' => $this->client->getClient(), 'account_id' => $account->getId()];
     } catch (AccountLockedException $e) {
         return false;
     } catch (RequireCaptchaException $e) {
         return false;
     } catch (\Exception $e) {
         return false;
     }
 }