From 6315d2c3ee37440013a79e66f0af35623b518bcb Mon Sep 17 00:00:00 2001 From: velz Date: Wed, 27 May 2026 17:16:16 +0530 Subject: [PATCH 1/4] FIX_DUAL_SAME_FUNCTION --- app/Controllers/RestAuthenticationController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index 906eacb..32884be 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -2019,7 +2019,7 @@ class RestAuthenticationController extends AdminController } - public function resetTokenTimeOut($bufferSeconds = null) + public function resetTokenTimeOutOLD($bufferSeconds = null) { if (!is_cli()) { return $this->respond([ From bf1234396b49426093fc962727c15a5398b5a748 Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 27 May 2026 17:35:10 +0530 Subject: [PATCH 2/4] FEAT_SAML_DOMAIN_LIST --- app/Config/Routes.php | 2 ++ .../RestAuthenticationController.php | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f3db0d7..37baad8 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -538,6 +538,8 @@ $routes->group("employeeRest", ['filter' => ['appSignature','AuthApiRateLimitFil $routes->post("verifyOtp", "RestAuthenticationController::verifyOtp"); $routes->post("checkPassword", "RestAuthenticationController::checkPassword"); $routes->get("downloadSampleExcel", "EmployeeRestController::downloadSampleExcel"); + $routes->get("getSamlDomainsList", "RestAuthenticationController::getSamlDomainsList"); + // $routes->post("getPreEmployeePolicyCount", "EmployeeRestController::getPreEmployeePolicyCount"); }); diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index 32884be..54612c5 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -2134,5 +2134,32 @@ class RestAuthenticationController extends AdminController echo json_encode($result, JSON_UNESCAPED_SLASHES) . PHP_EOL; } + + public function getSamlDomainsList() + { + try { + + $samlDomains = db_connect() + ->table('saml_client') + ->select('email_domain') + ->get() + ->getResultArray(); + + return $this->respond([ + 'status' => 'success', + 'code' => 200, + 'data' => array_column($samlDomains, 'email_domain'), + ], 200); + + } catch (\Throwable $th) { + + log_message('error', 'REST-AUTH-CONTROLLER - getSamlDomainsList error: ' . $th->getMessage()); + return $this->respond([ + 'status' => 'failed', + 'code' => 500, + 'message' => 'Unable to fetch SAML domains at the moment.', + ], 500); + } + } } From 56b302c855c163cbbfb772e3e418dd9375d34c90 Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Fri, 29 May 2026 11:26:23 +0530 Subject: [PATCH 3/4] CHANGE_ALL_PLACE_DATE_FORMAT --- app/Views/batch_list.php | 2 +- app/Views/client_policy.php | 124 ++++++++++++++++++++++++-------- app/Views/file_list.php | 2 +- app/Views/test_members_list.php | 2 +- 4 files changed, 97 insertions(+), 33 deletions(-) diff --git a/app/Views/batch_list.php b/app/Views/batch_list.php index b574791..9f90ffd 100755 --- a/app/Views/batch_list.php +++ b/app/Views/batch_list.php @@ -67,7 +67,7 @@ - by + by diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index ec60594..95cfd0f 100755 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -508,7 +508,7 @@ $(document).ready(function() { const showExpired = $('#chk-show-expired').is(':checked'); var startDatePicker = flatpickr("#start_date", { - dateFormat: "d-m-Y", + dateFormat: "d/m/Y", defaultDate: today, allowInput: false, onChange: function(selectedDates, dateStr, instance) { @@ -521,7 +521,7 @@ $(document).ready(function() { // Initialize Flatpickr for the start date with today's date var openDatePicker = flatpickr("#open_date", { - dateFormat: "d-m-Y", + dateFormat: "d/m/Y", defaultDate: today, allowInput: false, }); @@ -532,20 +532,20 @@ $(document).ready(function() { closeDate.setDate(closeDate.getDate() - 1); // Set end date to last day of next year var endDatePicker = flatpickr("#end_date", { - dateFormat: "d-m-Y", + dateFormat: "d/m/Y", defaultDate: closeDate, allowInput: false }); // Initialize Flatpickr for the end date with the calculated end date var closeDatePicker = flatpickr("#close_date", { - dateFormat: "d-m-Y", + dateFormat: "d/m/Y", defaultDate: today, allowInput: false }); // var reminderDatePicker = flatpickr("#reminder_date", { - // dateFormat: "d-m-Y", + // dateFormat: "d/m/Y", // defaultDate: today, // allowInput: false // }); @@ -630,7 +630,7 @@ $(document).ready(function() { ${policy_name_data} ${item.branch_name ? item.branch_name : ' - '} - ${(item.policy_start_date)} / ${(item.policy_end_date)} + ${formatDisplayDate(item.policy_start_date)} - ${formatDisplayDate(item.policy_end_date)} ${checkDateStatus(item.policy_end_date, 1)} @@ -785,6 +785,14 @@ $("#policy_form").submit(function(event) { $('.loader-mask').fadeIn(); var formData = new FormData($('#policy_form')[0]); + formData.set('policy_start_date', toBackendDateFormat($('#start_date').val())); + formData.set('policy_end_date', toBackendDateFormat($('#end_date').val())); + if ($('#open_date').val()) { + formData.set('open_date', toBackendDateFormat($('#open_date').val())); + } + if ($('#close_date').val()) { + formData.set('close_date', toBackendDateFormat($('#close_date').val())); + } var policy_form_action = $('#policy_form_action').val(); console.log(formData + 'form data'); $.ajax({ @@ -893,7 +901,7 @@ $("#policy_form").submit(function(event) { ${item.branch_name ? item.branch_name : ' - '} - ${(item.policy_start_date)} / ${(item.policy_end_date)} + ${formatDisplayDate(item.policy_start_date)} - ${formatDisplayDate(item.policy_end_date)} ${checkDateStatus(item.policy_end_date, 1)} @@ -1352,33 +1360,89 @@ $('body').on('click', '.btnOpenEnroll', function() { }); -//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy' +// Convert stored/API dates to d/m/Y for display and form inputs function rearrangeDateFormat(inputDate) { - - console.log('inputDate', inputDate) - // Check if inputDate is a string and not empty - if (typeof inputDate === 'string' && inputDate.trim() !== '') { - var dateComponents = inputDate.split("-"); - - // Check if dateComponents has the expected number of parts - if (dateComponents.length === 3) { - var rearrangedDate = dateComponents[2] + "-" + dateComponents[1] + "-" + dateComponents[0]; - return rearrangedDate; - } else { - // Handle unexpected date format - return ''; - } - } else { - // Handle the case where inputDate is not a valid string - return ''; - } + return formatDisplayDate(inputDate); } +function formatDisplayDate(inputDate) { + if (inputDate === null || inputDate === undefined) { + return ''; + } + + var value = String(inputDate).trim(); + if (value === '' || value === 'null') { + return ''; + } + + if (/^\d{1,2}\/\d{1,2}\/\d{4}$/.test(value)) { + return value; + } + + if (/^\d{4}-\d{2}-\d{2}/.test(value)) { + var ymdParts = value.split('-'); + return ymdParts[2] + '/' + ymdParts[1] + '/' + ymdParts[0]; + } + + if (/^\d{1,2}-\d{1,2}-\d{4}$/.test(value)) { + return value.replace(/-/g, '/'); + } + + var parsedDate = new Date(value); + if (!isNaN(parsedDate.getTime())) { + var day = String(parsedDate.getDate()).padStart(2, '0'); + var month = String(parsedDate.getMonth() + 1).padStart(2, '0'); + var year = parsedDate.getFullYear(); + return day + '/' + month + '/' + year; + } + + return ''; +} + +function toBackendDateFormat(displayDate) { + if (!displayDate) { + return displayDate; + } + + var value = String(displayDate).trim(); + if (/^\d{1,2}\/\d{1,2}\/\d{4}$/.test(value)) { + return value.replace(/\//g, '-'); + } + + return value; +} + +function parsePolicyDate(inputDate) { + if (!inputDate) { + return null; + } + + var value = String(inputDate).trim(); + if (/^\d{4}-\d{2}-\d{2}/.test(value)) { + return new Date(value); + } + + var slashParts = value.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/); + if (slashParts) { + return new Date(slashParts[3], slashParts[2] - 1, slashParts[1]); + } + + var hyphenParts = value.match(/^(\d{1,2})-(\d{1,2})-(\d{4})$/); + if (hyphenParts) { + return new Date(hyphenParts[3], hyphenParts[2] - 1, hyphenParts[1]); + } + + var parsedDate = new Date(value); + return isNaN(parsedDate.getTime()) ? null : parsedDate; +} function checkDateStatus(inputDate, bg = false) { - var givenDate = new Date(inputDate); + var givenDate = parsePolicyDate(inputDate); var currentDate = new Date(); + if (!givenDate) { + return bg ? '' : ''; + } if (bg != false) { if (givenDate < currentDate) { @@ -2149,7 +2213,7 @@ function getClientPolicyDataForEdit(client_policy_id) { $('#open_date').val(rearrangeDateFormat(res.data.open_date)); $('#end_date').val(rearrangeDateFormat(res.data.policy_end_date)); $('#close_date').val(rearrangeDateFormat(res.data.close_date)); - $('#reminder_date').val(rearrangeDateFormat(res.data.reminder_date)); + $('#reminder_date').val(res.data.reminder_date); $('#disclaimer').val(res.data.disclaimer); $('#gst_no').val(gst); $('#policy_status').val(checkDateStatus(res.data.policy_end_date)); @@ -2436,7 +2500,7 @@ $(document).ready(function () { ${policy_name_data} ${item.branch_name ? item.branch_name : ' - '} ${tpaValue} --> - ${(item.policy_start_date)} / ${(item.policy_end_date)} + ${formatDisplayDate(item.policy_start_date)} - ${formatDisplayDate(item.policy_end_date)} ${checkDateStatus(item.policy_end_date, 1)} @@ -2473,7 +2537,7 @@ $(document).ready(function () { ${policy_name_data} ${item.branch_name ? item.branch_name : ' - '} ${tpaValue} --> - ${(item.policy_start_date)} / ${(item.policy_end_date)} + ${formatDisplayDate(item.policy_start_date)} - ${formatDisplayDate(item.policy_end_date)} ${(enrollmentStatus)} --> ${checkDateStatus(item.policy_end_date, 1)} diff --git a/app/Views/file_list.php b/app/Views/file_list.php index 1e765aa..67982b3 100755 --- a/app/Views/file_list.php +++ b/app/Views/file_list.php @@ -73,7 +73,7 @@ - - ' . $file['first_name'] . '' ?> + ' . $file['first_name'] . '' ?> - + - From 38f04bb1760aaab5ccaca923b3485c209d5a39e6 Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 10 Jun 2026 12:42:37 +0530 Subject: [PATCH 4/4] FIX_RATE_LIMIT_USER_BLOCK_RESPONCE --- app/Filters/AuthApiRateLimitFilter.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Filters/AuthApiRateLimitFilter.php b/app/Filters/AuthApiRateLimitFilter.php index 210bd0b..51c8409 100644 --- a/app/Filters/AuthApiRateLimitFilter.php +++ b/app/Filters/AuthApiRateLimitFilter.php @@ -105,12 +105,16 @@ class AuthApiRateLimitFilter implements FilterInterface protected function resolveIdentity(RequestInterface $request): ?string { // Try POST body first - $email = $request->getPost('email'); - $mobile = $request->getPost('mobile_number'); + + $request_data = $request->getPost() ?: $request->getJSON(true) ?? []; + // print_r($request_data); die; + + $email = $request_data['email'] ?? $request_data['email_id'] ?? null; + $mobile = $request_data['mobile_number'] ?? null; // Fallback to GET params if (! $email && ! $mobile) { - $email = $request->getGet('email'); + $email = $request->getGet('email') ?? $request->getGet('email_id'); $mobile = $request->getGet('mobile_number'); }