X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=app%2FController%2FGithub%2FCallback.php;h=1b7f34f1ce1651ff1f43827db0ea7e2c3680c560;hb=eb76e9bb9a39fe2725301f6cf6fc3cf29bbc4e00;hp=d6d11920c6bd14ab3ecd465356536b1b49e94175;hpb=26494fb5cdfb9cf103904d10b6bda564bcf2d0bd;p=pharext%2Fpharext.org diff --git a/app/Controller/Github/Callback.php b/app/Controller/Github/Callback.php index d6d1192..1b7f34f 100644 --- a/app/Controller/Github/Callback.php +++ b/app/Controller/Github/Callback.php @@ -28,24 +28,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");