X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=app%2FController%2FGithub%2FCallback.php;h=646d782f20d52c59676efdbd23a72a39ddd3c5ba;hb=2f593903bb0b095e3ecaece6c8e73ab3410af64f;hp=d6d11920c6bd14ab3ecd465356536b1b49e94175;hpb=26494fb5cdfb9cf103904d10b6bda564bcf2d0bd;p=pharext%2Fpharext.org diff --git a/app/Controller/Github/Callback.php b/app/Controller/Github/Callback.php index d6d1192..646d782 100644 --- a/app/Controller/Github/Callback.php +++ b/app/Controller/Github/Callback.php @@ -4,14 +4,12 @@ namespace app\Controller\Github; use app\Controller\Github; use app\Github\API; -use app\Github\Exception; use app\Model\Accounts; use app\Session; use app\Web; class Callback extends Github { - /** * @var Accounts */ @@ -28,24 +26,20 @@ class Callback extends Github "error" => $this->app->getRequest()->getQuery("error_description") ]); } else { - try { - $this->github->fetchToken( - $this->app->getRequest()->getQuery("code"), - $this->app->getRequest()->getQuery("state"), - function($token) { - $this->github->setToken($token->access_token); - $this->github->fetchUser($this->createUserCallback($token)); - })->send(); - if (isset($this->session->returnto)) { - $returnto = $this->session->returnto; - unset($this->session->returnto); - $this->app->redirect($returnto); - } else { - $this->app->redirect( - $this->app->getBaseUrl()->mod("./github")); - } - } catch (Exception $exception) { - $this->app->getView()->addData(compact("exception")); + $this->github->fetchToken( + $this->app->getRequest()->getQuery("code"), + $this->app->getRequest()->getQuery("state"), + function($token) { + $this->github->setToken($token->access_token); + $this->github->readAuthUser($this->createUserCallback($token)); + })->send(); + if (isset($this->session->returnto)) { + $returnto = $this->session->returnto; + unset($this->session->returnto); + $this->app->redirect($returnto); + } else { + $this->app->redirect( + $this->app->getBaseUrl()->mod("./github")); } } $this->app->display("github/callback");