Validate if github_token exists
Validate if the github_token session key exists before call it
This commit is contained in:
parent
3b196a3072
commit
3f9b678d2b
|
@ -107,6 +107,8 @@ class ProjectController extends b8\Controller
|
||||||
*/
|
*/
|
||||||
public function add()
|
public function add()
|
||||||
{
|
{
|
||||||
|
$_SESSION['github_token'] = isset($_SESSION['github_token']) ? $_SESSION['github_token'] : null;
|
||||||
|
|
||||||
if (!Registry::getInstance()->get('user')->getIsAdmin()) {
|
if (!Registry::getInstance()->get('user')->getIsAdmin()) {
|
||||||
throw new \Exception('You do not have permission to do that.');
|
throw new \Exception('You do not have permission to do that.');
|
||||||
}
|
}
|
||||||
|
@ -151,7 +153,7 @@ class ProjectController extends b8\Controller
|
||||||
$view->project = null;
|
$view->project = null;
|
||||||
$view->form = $form;
|
$view->form = $form;
|
||||||
$view->key = $pub;
|
$view->key = $pub;
|
||||||
$view->token = $_SESSION['github_token'] ? $_SESSION['github_token'] : null;
|
$view->token = $_SESSION['github_token'];
|
||||||
|
|
||||||
return $view->render();
|
return $view->render();
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,8 @@ class SessionController extends b8\Controller
|
||||||
*/
|
*/
|
||||||
public function logout()
|
public function logout()
|
||||||
{
|
{
|
||||||
unset($_SESSION['user_id']);
|
$_SESSION = array();
|
||||||
unset($_SESSION['github_token']);
|
session_destroy();
|
||||||
header('Location: /');
|
header('Location: /');
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue