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()
|
||||
{
|
||||
$_SESSION['github_token'] = isset($_SESSION['github_token']) ? $_SESSION['github_token'] : null;
|
||||
|
||||
if (!Registry::getInstance()->get('user')->getIsAdmin()) {
|
||||
throw new \Exception('You do not have permission to do that.');
|
||||
}
|
||||
|
@ -151,7 +153,7 @@ class ProjectController extends b8\Controller
|
|||
$view->project = null;
|
||||
$view->form = $form;
|
||||
$view->key = $pub;
|
||||
$view->token = $_SESSION['github_token'] ? $_SESSION['github_token'] : null;
|
||||
$view->token = $_SESSION['github_token'];
|
||||
|
||||
return $view->render();
|
||||
}
|
||||
|
|
|
@ -70,8 +70,8 @@ class SessionController extends b8\Controller
|
|||
*/
|
||||
public function logout()
|
||||
{
|
||||
unset($_SESSION['user_id']);
|
||||
unset($_SESSION['github_token']);
|
||||
$_SESSION = array();
|
||||
session_destroy();
|
||||
header('Location: /');
|
||||
die;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue