Fixed issue #77.

This commit is contained in:
Rooty 2021-04-21 18:27:01 +02:00
parent 6009d62afc
commit 70f3c92c55
3 changed files with 21 additions and 7 deletions

View File

@ -268,17 +268,25 @@ $GLOBALS['CONF_SESSION_TIME']=3600;
*/
$GLOBALS['CONF_COOKIE_ENABLE']=true;
/**
* @global chaine $GLOBALS['CONF_COOKIE_PREFIX']
* @name $CONF_COOKIE_PREFIX
* @desc prefix du cookie...
* Available values: __Secure-, __Host-
*/
$GLOBALS['CONF_COOKIE_PREFIX']="__Host-";
/**
* @global chaine $GLOBALS['CONF_COOKIE_PATH']
* @name $CONF_COOKIE_PATH
* @desc chemin du cookie...
*/
$GLOBALS['CONF_COOKIE_PATH']="";
$GLOBALS['CONF_COOKIE_PATH']="/";
/**
* @global chaine $GLOBALS['CONF_COOKIE_SECURE']
* @name $CONF_COOKIE_SECURE
* @desc cookie et https à 0 ou 1 (1=actif)
* @desc cookie https à true ou false (true=actif)
*/
$GLOBALS['CONF_COOKIE_SECURE']=1;
$GLOBALS['CONF_COOKIE_SECURE']=true;
?>

View File

@ -414,7 +414,12 @@ var $currentCoordinationObject=null;
} else {
$password=NULL;
}
setcookie("showLandPage", "false", time() + (86400 * 30), '/');
// setcookie("showLandPage", "false", time() + (86400 * 30), '/');
/* Use new PHP7.3.0 array method */
$arr_cookie_options = array ('expires' => time() + (86400 * 30),'path' => $CONF_COOKIE_PATH,'domain' => $CONF_COOKIE_DOMAIN,'secure' => $CONF_COOKIE_SECURE,'httponly' => true,'samesite' => 'Lax');
setcookie($CONF_COOKIE_PREFIX.'showLandPage', "false", $arr_cookie_options);
if (!is_null($login) && !is_null($password)) {
$this->__authSession($login, $password);
// if(file_exists("/usr/local/sbin/xmpp_notification.py"))

View File

@ -162,7 +162,7 @@ var $permission;
*/
function __construct()
{
global $SYSTEM_IP, $_SERVER, $CONF_COOKIE_ENABLE, $CONF_COOKIE_PATH, $CONF_COOKIE_DOMAIN, $CONF_COOKIE_SECURE;
global $SYSTEM_IP, $_SERVER, $CONF_COOKIE_ENABLE, $CONF_COOKIE_PREFIX, $CONF_COOKIE_PATH, $CONF_COOKIE_DOMAIN, $CONF_COOKIE_SECURE;
$init=true;
/* Récupération de l'id en fonction du cookie et/ou du $GET */
@ -202,8 +202,9 @@ var $permission;
if ($CONF_COOKIE_ENABLE)
{
if (!headers_sent()){
// setcookie ( string $name [, string $value = "" [, int $expires = 0 [, string $path = "" [, string $domain = "" [, bool $secure = FALSE [, bool $httponly = FALSE ]]]]]] ) : bool
setcookie('SessionId', $this->id, time()+3600, $CONF_COOKIE_PATH, $CONF_COOKIE_DOMAIN, $CONF_COOKIE_SECURE);
/* Use new PHP7.3.0 array method */
$arr_cookie_options = array ('expires' => time()+3600,'path' => $CONF_COOKIE_PATH,'domain' => $CONF_COOKIE_DOMAIN,'secure' => $CONF_COOKIE_SECURE,'httponly' => true,'samesite' => 'Lax');
setcookie($CONF_COOKIE_PREFIX.'SessionId', $this->id, $arr_cookie_options);
}else{
addError(4, "User Session", "Impossible de créer le cookie correspondant...", __line__, __file__);
}