protected function checkUserCredentials($client_id, $username, $password) { try { $this->setClient(API_OAuth2_Application::load_from_client_id($this->app, $client_id)); $usr_id = $this->app['auth.native']->getUsrId($username, $password, Request::createFromGlobals()); if (!$usr_id) { return false; } if (null === ($user = $this->app['manipulator.user']->getRepository()->find($usr_id))) { return false; } $account = $this->updateAccount($user); return ['redirect_uri' => $this->client->get_redirect_uri(), 'client_id' => $this->client->get_client_id(), 'account_id' => $account->get_id()]; } catch (AccountLockedException $e) { return false; } catch (RequireCaptchaException $e) { return false; } catch (\Exception $e) { return false; } }