Commit 73dbbcd7 authored by Ad Schellevis's avatar Ad Schellevis

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

parent ac75ef6f
......@@ -170,7 +170,8 @@ 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"));
$secure = $config['system']['webgui']['protocol'] == "https";
setcookie(session_name(), session_id(), null, '/', null, $secure, true);
}
}
......
......@@ -43,11 +43,14 @@ class LegacyCSRF
private function Session()
{
global $config;
if ($this->session == null) {
$this->session = new Phalcon\Session\Adapter\Files();
$this->session->start();
$secure = $config['system']['webgui']['protocol'] == 'https';
setcookie(session_name(), session_id(), null, '/', null, $secure, true);
if (!isset($_COOKIE[session_name()])) {
$secure = $config['system']['webgui']['protocol'] == 'https';
setcookie(session_name(), session_id(), null, '/', null, $secure, true);
}
$this->di->setShared('session', $this->session);
}
}
......
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