From 0e0a881375cf18a82182cc11ee7d0c5642a14873 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Wed, 8 Jan 2025 09:17:03 +0530 Subject: [PATCH 1/4] FEAT_COOKIE_SAVE_AND_CHECK ADDED --- app/Controllers/LoginController.php | 16 ++++++----- app/Filters/AuthMVC.php | 3 +-- app/Helpers/oauth_helper.php | 2 +- app/Helpers/session_helper.php | 41 ++++++++++++++++++++++++----- composer.json | 2 +- 5 files changed, 48 insertions(+), 16 deletions(-) diff --git a/app/Controllers/LoginController.php b/app/Controllers/LoginController.php index 10c4271..b3ca218 100755 --- a/app/Controllers/LoginController.php +++ b/app/Controllers/LoginController.php @@ -19,17 +19,16 @@ class LoginController extends BaseController // set_session_data($session_data); // $isLoggedIn = check_session(); $isLoggedIn = check_session(); - - if ($isLoggedIn) { + $hasCookie = check_cookie(); + if ($isLoggedIn || $hasCookie) { return redirect()->to(base_url('/dashboard/view')); } return view('login'); } - + public function receiveGoogleOAuthResponse() { - $UserModel = new UserModel(); //echo 'DONE';die(); if ($this->request->getGet('code')) { @@ -52,7 +51,10 @@ class LoginController extends BaseController 'userProfile' => $value->picture, 'user_team' => $user_team, ]; - + $path = getenv('cookie.Path'); + $domain = getenv('cookie.Domain'); + $https = getenv('ccokie.secure'); + setcookie('session_data', json_encode($session_data), time() + 12 * 60 * 60, $path, $domain, $https, true); set_session_data($session_data); log_message('error', 'Set The UserId : `'. $user->id .'` in Session'); @@ -82,12 +84,14 @@ class LoginController extends BaseController public function initiateGoogleOAuth() { - return googleOAuthLogin(false); + return googleOAuthLogin(false); } public function logout() { + $path = getenv('cookie.Path'); session()->destroy(); + setcookie('session_data', '', time() - 3600, $path); return redirect()->to(base_url('login')); } diff --git a/app/Filters/AuthMVC.php b/app/Filters/AuthMVC.php index aa40610..0a9f7a6 100755 --- a/app/Filters/AuthMVC.php +++ b/app/Filters/AuthMVC.php @@ -9,8 +9,7 @@ class AuthMVC implements FilterInterface { public function before(RequestInterface $request, $arguments = null) { - if (!check_session()) { - + if (!check_session() && !check_cookie()) { return redirect()->to(base_url('/login')); } diff --git a/app/Helpers/oauth_helper.php b/app/Helpers/oauth_helper.php index a16ef36..9b3fba3 100755 --- a/app/Helpers/oauth_helper.php +++ b/app/Helpers/oauth_helper.php @@ -1,6 +1,6 @@ getUserByEmail($value['userData']->email); + if($user){ + if($user->is_active !== '0'){ + $user_team = $UserModel->getUserTeamsByUserID($user->id); + // dd($user_team); + + $session_data = [ + 'isLoggedIn' => True , + 'userid' => $user->id, + 'userData' => $user, + 'userProfile' => $value['userProfile'], + 'user_team' => $user_team, + ]; + set_session_data($session_data); + // $this->getUserDeviceInfo($user->id, 'NhanceUser'); + // return redirect()->to(base_url('/dashboard/view')); + return true; + + } + // $session_data = (array)json_decode($_COOKIE['session_data']); + // set_session_data($session_data); + } + }else{ + return false; + } +} +} if (!function_exists('check_session')) { function check_session() @@ -148,9 +183,3 @@ if (!function_exists('user_team')) { return $session->get('user_team'); } } - - - - - - diff --git a/composer.json b/composer.json index c456241..e2f8787 100755 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "ext-mbstring": "*", "dompdf/dompdf": "^2.0", "firebase/php-jwt": "^6.10", - "google/apiclient": "^2.15.0", + "google/apiclient": "^2.18", "kreait/firebase-php": "^7.0", "laminas/laminas-escaper": "^2.9", "php-amqplib/php-amqplib": "^2.8", From 502335304033df22123e8d34a12fddd3bddbb4b3 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Wed, 8 Jan 2025 10:55:22 +0530 Subject: [PATCH 2/4] FIX_ROW_ON_CLICK_TABLE_ALIGNMENT --- app/Helpers/session_helper.php | 6 +- app/Views/insurer_list.php | 53 +++--------------- app/Views/insurer_statement_list.php | 55 ++----------------- app/Views/kyc_list.php | 53 +++--------------- app/Views/leads_list.php | 53 +++--------------- .../policy_transaction_inception_list.php | 53 ++---------------- app/Views/test_members_list.php | 39 ++++++++++--- app/Views/tpa_list.php | 54 +++--------------- 8 files changed, 74 insertions(+), 292 deletions(-) diff --git a/app/Helpers/session_helper.php b/app/Helpers/session_helper.php index 396d74d..3d312d6 100755 --- a/app/Helpers/session_helper.php +++ b/app/Helpers/session_helper.php @@ -15,7 +15,7 @@ if(!function_exists('check_cookie')){ // dd($user_team); $session_data = [ - 'isLoggedIn' => True , + 'isLoggedIn' => True, 'userid' => $user->id, 'userData' => $user, 'userProfile' => $value['userProfile'], @@ -30,11 +30,11 @@ if(!function_exists('check_cookie')){ // $session_data = (array)json_decode($_COOKIE['session_data']); // set_session_data($session_data); } - }else{ + }else{ return false; + } } } -} if (!function_exists('check_session')) { function check_session() diff --git a/app/Views/insurer_list.php b/app/Views/insurer_list.php index 933ed3b..150f9be 100755 --- a/app/Views/insurer_list.php +++ b/app/Views/insurer_list.php @@ -1,70 +1,31 @@
diff --git a/app/Views/insurer_statement_list.php b/app/Views/insurer_statement_list.php index 2772907..83dee91 100644 --- a/app/Views/insurer_statement_list.php +++ b/app/Views/insurer_statement_list.php @@ -108,75 +108,32 @@ table.dataTable tbody td { color: gray; } -custom-dropdown-menu { + .custom-dropdown-menu { display: none; - position: fixed; + position: absolute; background-color: #ffffff !important; - border: 1px solid rgba(0,0,0,.15); + border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 0.25rem; padding: 0.5rem 0; min-width: 10rem; z-index: 9999; - box-shadow: 0 0 10px rgba(0,0,0,0.1); + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } .custom-dropdown-menu .dropdown-item { display: block !important; width: 100% !important; padding: 0.5rem 1rem !important; - clear: both !important; - font-weight: 400 !important; color: #212529 !important; - text-align: inherit !important; - white-space: nowrap !important; - background-color: transparent !important; - border: 0 !important; text-decoration: none !important; - position: relative !important; + background-color: transparent !important; } .custom-dropdown-menu .dropdown-item:hover { background-color: #f8f9fa !important; color: #16181b !important; cursor: pointer !important; -} - -.custom-dropdown-menu .dropdown-item i { - margin-right: 8px !important; - vertical-align: middle !important; -} - -.table tbody tr { - cursor: pointer; -} - -/* Ensure the dropdown menu has a solid background */ -.custom-dropdown-menu::before { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: #ffffff; - z-index: -1; -} - -/* Add a subtle backdrop effect */ -.custom-dropdown-menu::after { - content: ''; - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: rgba(0,0,0,0.05); - z-index: -2; - pointer-events: none; -} - - - +}
diff --git a/app/Views/kyc_list.php b/app/Views/kyc_list.php index a28b2df..e6c0870 100755 --- a/app/Views/kyc_list.php +++ b/app/Views/kyc_list.php @@ -1,70 +1,31 @@
diff --git a/app/Views/leads_list.php b/app/Views/leads_list.php index 78665e9..ddf4d23 100644 --- a/app/Views/leads_list.php +++ b/app/Views/leads_list.php @@ -37,72 +37,33 @@ table.dataTable tbody td { margin-bottom: 10px; } -custom-dropdown-menu { + +.custom-dropdown-menu { display: none; - position: fixed; + position: absolute; background-color: #ffffff !important; - border: 1px solid rgba(0,0,0,.15); + border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 0.25rem; padding: 0.5rem 0; min-width: 10rem; z-index: 9999; - box-shadow: 0 0 10px rgba(0,0,0,0.1); + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } .custom-dropdown-menu .dropdown-item { display: block !important; width: 100% !important; padding: 0.5rem 1rem !important; - clear: both !important; - font-weight: 400 !important; color: #212529 !important; - text-align: inherit !important; - white-space: nowrap !important; - background-color: transparent !important; - border: 0 !important; text-decoration: none !important; - position: relative !important; + background-color: transparent !important; } .custom-dropdown-menu .dropdown-item:hover { background-color: #f8f9fa !important; color: #16181b !important; cursor: pointer !important; -} - -.custom-dropdown-menu .dropdown-item i { - margin-right: 8px !important; - vertical-align: middle !important; -} - -.table tbody tr { - cursor: pointer; -} - -/* Ensure the dropdown menu has a solid background */ -.custom-dropdown-menu::before { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: #ffffff; - z-index: -1; -} - -/* Add a subtle backdrop effect */ -.custom-dropdown-menu::after { - content: ''; - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: rgba(0,0,0,0.05); - z-index: -2; - pointer-events: none; -} +} diff --git a/app/Views/policy_transaction_inception_list.php b/app/Views/policy_transaction_inception_list.php index 80f9fe6..0db1241 100644 --- a/app/Views/policy_transaction_inception_list.php +++ b/app/Views/policy_transaction_inception_list.php @@ -45,73 +45,32 @@ table.dataTable tbody td { .addbtnStyle{ margin-left: 20px !important; } -custom-dropdown-menu { +.custom-dropdown-menu { display: none; - position: fixed; + position: absolute; background-color: #ffffff !important; - border: 1px solid rgba(0,0,0,.15); + border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 0.25rem; padding: 0.5rem 0; min-width: 10rem; z-index: 9999; - box-shadow: 0 0 10px rgba(0,0,0,0.1); + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } .custom-dropdown-menu .dropdown-item { display: block !important; width: 100% !important; padding: 0.5rem 1rem !important; - clear: both !important; - font-weight: 400 !important; color: #212529 !important; - text-align: inherit !important; - white-space: nowrap !important; - background-color: transparent !important; - border: 0 !important; text-decoration: none !important; - position: relative !important; + background-color: transparent !important; } .custom-dropdown-menu .dropdown-item:hover { background-color: #f8f9fa !important; color: #16181b !important; cursor: pointer !important; -} - -.custom-dropdown-menu .dropdown-item i { - margin-right: 8px !important; - vertical-align: middle !important; -} - -.table tbody tr { - cursor: pointer; -} - -/* Ensure the dropdown menu has a solid background */ -.custom-dropdown-menu::before { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: #ffffff; - z-index: -1; -} - -/* Add a subtle backdrop effect */ -.custom-dropdown-menu::after { - content: ''; - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: rgba(0,0,0,0.05); - z-index: -2; - pointer-events: none; -} - +} @@ -156,12 +177,13 @@ + - - + } --> + */ + ?> @@ -392,7 +415,7 @@