public function handle(array $params = null) { if (Request::hasParameter('account') && is_array($params) && isset($params[1])) { $currentAccount = null; if (Request::hasParameter('currentAccount')) { $currentAccount = Request::getParameter('currentAccount'); } $account = Request::getParameter('account'); $project = Project::findOne(['uid' => $account->uid, 'identifier' => $params[1]]); if (!empty($project)) { if ($project->is_public != '1') { if (is_null($currentAccount)) { Exception::throwException(10004); } elseif ($project->uid != $currentAccount->uid) { Exception::throwException(10004); } } Request::addParameter('project', $project); } else { Exception::throwException(10003); } } else { Exception::throwException(10001); } }
public function handle(array $params = null) { $tokenName = Application::getInstance()->config->get('App.cookie_prefix') . Application::getInstance()->config->get('App.token_cookie_name'); $token = Input::cookie($tokenName); if (!empty($token)) { $result = Account::where('ucenter_token', $token)->limit(1)->get(); if (!empty($result)) { $result = $result[0]; if (time() < $result->token_expired) { Request::addParameter('currentAccount', $result); } } } }
public function handle(array $params = null) { if (is_array($params) && isset($params[0])) { $accountIdentifier = $params[0]; $account = Account::findOne(['identifier' => $accountIdentifier]); if (!empty($account)) { Request::addParameter('account', $account); } else { Exception::throwException(10002); } } else { Exception::throwException(10002); } }