From 9b87017d8a74f74c16d210821de4ca3e4083f517 Mon Sep 17 00:00:00 2001 From: toseppo Date: Sat, 31 Aug 2024 12:34:09 +0300 Subject: [PATCH 1/2] Fix user login / edit set cookies --- application/controllers/User.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/controllers/User.php b/application/controllers/User.php index 25cdfa2fb..c943b1018 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -661,7 +661,7 @@ class User extends CI_Controller { 'name' => $this->config->item('gettext_cookie', 'gettext'), 'value' => $this->input->post('user_language', true), - 'expire' => time()+1000, + 'expire' => 1000, 'secure' => FALSE ); @@ -894,7 +894,7 @@ class User extends CI_Controller { 'name' => $this->config->item('gettext_cookie', 'gettext'), 'value' => $data['user']->user_language, - 'expire' => time()+1000, + 'expire' => 1000, 'secure' => FALSE ); From d92258e9aebbc9725dd3944f250881b188b77aad Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Mon, 2 Sep 2024 14:25:23 +0200 Subject: [PATCH 2/2] fix other expire times --- application/controllers/User.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/controllers/User.php b/application/controllers/User.php index c943b1018..a4e4274bd 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -854,7 +854,7 @@ class User extends CI_Controller { log_message('debug', "User ID: [$uid] Login rejected because of an active maintenance mode (and he is no admin)."); // Delete keep_login cookie - $this->input->set_cookie('keep_login', '', time() - 3600, ''); + $this->input->set_cookie('keep_login', '', -3600, ''); redirect('user/login'); } @@ -863,7 +863,7 @@ class User extends CI_Controller { log_message('debug', "User ID: [$uid] Login rejected because of non matching hash key ('Keep Login')."); // Delete keep_login cookie - $this->input->set_cookie('keep_login', '', time() - 3600, ''); + $this->input->set_cookie('keep_login', '', -3600, ''); $this->session->set_flashdata('error', __("Login failed. Try again.")); redirect('user/login'); } @@ -872,7 +872,7 @@ class User extends CI_Controller { log_message('error', "User ID: [".$uid."]; 'Keep Login' failed. Cookie deleted. Message: ".$e); // Delete keep_login cookie - $this->input->set_cookie('keep_login', '', time() - 3600, ''); + $this->input->set_cookie('keep_login', '', -3600, ''); $this->session->set_flashdata('error', __("Login failed. Try again.")); redirect('user/login'); @@ -908,7 +908,7 @@ class User extends CI_Controller { $cookie = array( 'name' => 'keep_login', 'value' => $encrypted_string, - 'expire' => '2592000', // 30 days + 'expire' => 2592000, // 30 days 'secure' => TRUE, 'httponly' => TRUE ); @@ -935,7 +935,7 @@ class User extends CI_Controller { $user_name = $this->session->userdata('user_name'); // Delete keep_login cookie - $this->input->set_cookie('keep_login', '', time() - 3600, ''); + $this->input->set_cookie('keep_login', '', -3600, ''); $this->user_model->clear_session();