FEAT_COOKIE DATA SAVE AND VERIFY ADDED - SRINIVAS
This commit is contained in:
parent
be72e38a61
commit
562153c2d0
@ -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'));
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +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'));
|
||||
}
|
||||
|
||||
@ -1,5 +1,39 @@
|
||||
<?php
|
||||
|
||||
use App\Models\UserModel;
|
||||
|
||||
if(!function_exists('check_cookie')){
|
||||
function check_cookie(){
|
||||
$UserModel = new UserModel();
|
||||
|
||||
if(isset($_COOKIE['session_data'])){
|
||||
$value = (array)json_decode($_COOKIE['session_data']);
|
||||
$user = $UserModel->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()
|
||||
@ -150,7 +184,7 @@ if (!function_exists('user_team')) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -87,6 +87,27 @@
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
th, td {
|
||||
text-align: center; /* Or left/right depending on your preference */
|
||||
vertical-align: middle; /* Ensures content is vertically centered */
|
||||
}
|
||||
input[type="checkbox"] {
|
||||
width: 16px; /* Standard checkbox size */
|
||||
height: 16px;
|
||||
margin: 0; /* Remove default margin */
|
||||
vertical-align: middle; /* Align with text or other elements */
|
||||
}
|
||||
th:first-child, td:first-child {
|
||||
width: 50px; /* Adjust width as needed */
|
||||
}
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.table {
|
||||
table-layout: fixed; /* Prevent columns from resizing dynamically */
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
@ -156,12 +177,13 @@
|
||||
<td><?php echo $employee['relationship']; ?></td>
|
||||
<td><?php echo $employee['gender']; ?></td>
|
||||
<td><?php echo date('d/M/Y', strtotime($employee['dob'])); ?></td>
|
||||
<?php /*
|
||||
|
||||
<!-- <td><?php //echo isset($employee['policy_type']) ? $employee['policy_type'] : ''; ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : ''; ?></td>
|
||||
<td><?php //echo isset($employee['insurer_short_name'])?$employee['insurer_short_name']:''; ?></td>
|
||||
<td><?php // echo isset($employee['tpa_id'])?$employee['tpa_id']:''; ?></td>
|
||||
<td><?php //echo isset($employee['uhid'])?$employee['uhid']: ""; ?></td>
|
||||
<td>
|
||||
<?php /*
|
||||
if(isset($employee['status'])){
|
||||
|
||||
switch ($employee['status']) {
|
||||
@ -185,13 +207,14 @@
|
||||
break;
|
||||
}
|
||||
|
||||
}*/
|
||||
?>
|
||||
}
|
||||
</td>
|
||||
<td><?php // if(isset($employee['basic_cover_si'])) {echo (format_indian_number($employee['basic_cover_si']))?format_indian_number($employee['basic_cover_si']):''; }?></td>
|
||||
<td><?php //if(isset($employee['premium'])) { echo null!=(format_indian_number($employee['premium']))? format_indian_number($employee['premium']):''; } ?></td>
|
||||
<td><?php //if(isset($employee['rata_premimum'])){$pro_rata_total += $employee['rata_premimum']; echo format_indian_number($employee['rata_premimum']);} ?></td>
|
||||
<td><?php // if(isset($employee['gst'])){$gst_total += $employee['gst']; echo format_indian_number($employee['gst']); }?></td> -->
|
||||
*/
|
||||
?>
|
||||
<td><?= $employee['policy_count'] ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
@ -209,7 +232,7 @@
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<tr><?php /*
|
||||
<th></th>
|
||||
<?php if (isset($getData)) {
|
||||
if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
|
||||
@ -233,7 +256,7 @@
|
||||
<th><?php echo format_indian_number($pro_rata_total); ?></th>
|
||||
<th><?php echo format_indian_number($gst_total); ?></th> -->
|
||||
<th></th>
|
||||
</tr>
|
||||
</tr> */ ?>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
@ -392,7 +415,7 @@
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const table = document.getElementById("tickets-table");
|
||||
|
||||
// Create custom dropdown
|
||||
@ -421,8 +444,8 @@
|
||||
document.body.appendChild(customDropdown);
|
||||
|
||||
row.addEventListener("click", function(event) {
|
||||
// Ignore clicks on the action column
|
||||
if (event.target.closest('td:last-child')) {
|
||||
// Ignore clicks on the first column (td:first-child)
|
||||
if (event.target.closest('td:first-child')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user