Commit 52815848 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

csrf/cookie, fix Secure Attribute and align session cookie in authgui.inc

(cherry picked from commit 73dbbcd7)
(cherry picked from commit c7786bde)
parent abb22624
......@@ -168,10 +168,7 @@ function session_auth(&$Login_Error)
);
if (session_status() == PHP_SESSION_NONE) {
if (session_start()) {
$sess_name = session_name();
setcookie($sess_name, session_id(), null, '/', null, null, ($config['system']['webgui']['protocol'] == "https"));
}
session_start();
}
// Detect protocol change
......@@ -264,7 +261,8 @@ function session_auth(&$Login_Error)
$_SESSION = array();
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
$secure = $config['system']['webgui']['protocol'] == "https";
setcookie(session_name(), '', time()-42000, '/', null, $secure, true);
}
/* and destroy it */
......
......@@ -43,6 +43,7 @@ class LegacyCSRF
private function Session()
{
global $config;
if ($this->session == null) {
$this->session = new Phalcon\Session\Adapter\Files();
$this->session->start();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment