Route fixes : ps
This commit is contained in:
parent
172182f315
commit
6f4ba689fa
@ -41,6 +41,7 @@ $routes->get('dashboard/', 'Home::index');
|
||||
|
||||
# Users Routes
|
||||
$routes->get("user_list/", "Users::index");
|
||||
// $routes->get('user-list/', 'Users::index', ['as' => 'user_list']);
|
||||
$routes->get("user_page/(:any)", "Users::user_page/$1");
|
||||
$routes->post("user_synchronization", "Users::user_synchronization");
|
||||
|
||||
|
||||
@ -32,15 +32,16 @@ class Authentication extends BaseController
|
||||
$password = $this->request->getPost('password');
|
||||
|
||||
$user = $auth_model->where('email', $username)->first();
|
||||
|
||||
if (is_null($user)) {
|
||||
return redirect()->back()->with('error', 'Invalid username or password.');
|
||||
// return redirect()->back()->withInput()->with('error', 'Invalid username or password.');
|
||||
}
|
||||
|
||||
$pwd_verify = password_verify((string)$password, $user['password']);
|
||||
|
||||
if (!$pwd_verify) {
|
||||
return redirect()->back()->with('error', 'Invalid username or password.');
|
||||
// return redirect()->back()->with('error', 'Invalid username or password.');
|
||||
return redirect()->back()->withInput()->with('error', 'Invalid username or password.');
|
||||
}
|
||||
|
||||
// You can implement your authentication logic here
|
||||
@ -60,11 +61,15 @@ class Authentication extends BaseController
|
||||
return redirect()->to('dashboard');
|
||||
} else {
|
||||
// Invalid credentials, display error message
|
||||
return redirect()->back()->with('error', 'Invalid username or password.');
|
||||
// return redirect()->back()->with('error', 'Invalid username or password.');
|
||||
return redirect()->back()->withInput()->with('error', 'Invalid username or password.');
|
||||
|
||||
}
|
||||
} else {
|
||||
// Validation failed, display errors
|
||||
return redirect()->back()->withInput()->with('validation', $validation);
|
||||
// return redirect()->back()->withInput()->with('validation', $validation);
|
||||
return redirect()->back()->withInput()->with('error', 'Invalid username or password.');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -58,6 +58,7 @@ class Users extends BaseController
|
||||
$requestData['isactive'] = isset($requestData['isactive']) && $requestData['isactive'] == 'on' ? 1 : 0;
|
||||
unset($requestData['password']);
|
||||
$model->saveData($requestData, $requestData['user_id']);
|
||||
$alert_message = "User successfully updated.";
|
||||
} else {
|
||||
#add
|
||||
$hash_password = password_hash($requestData['password'], PASSWORD_DEFAULT);
|
||||
@ -65,7 +66,8 @@ class Users extends BaseController
|
||||
$requestData['created_by'] = $session->get('user_id');
|
||||
$requestData['isactive'] = 1;
|
||||
$model->saveData($requestData, null);
|
||||
$alert_message = "User successfully created.";
|
||||
}
|
||||
return redirect()->route('user_list');
|
||||
return redirect()->route('user_list')->with('success', $alert_message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
<div class="float-right">
|
||||
<a href="new_bussiness" class="btn btn-primary"><i class="ri-user-add-line"></i> Add New </a>
|
||||
<a href="<?= base_url()."new_bussiness"; ?>" class="btn btn-primary"><i class="ri-user-add-line"></i> Add New </a>
|
||||
</div><!-- end col-->
|
||||
<br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
|
||||
@ -119,19 +119,19 @@
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="user_list">
|
||||
<a href="<?= base_url()."user_list"; ?>">
|
||||
<i class="ri-user-line"></i>
|
||||
<span> Users </span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="book_list">
|
||||
<a href="<?= base_url()."book_list"; ?>">
|
||||
<i class=" ri-book-open-line"></i>
|
||||
<span> Books </span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="business_list">
|
||||
<a href="<?= base_url()."business_list"; ?>">
|
||||
<i class="fa fa-industry"></i>
|
||||
<span> Business </span>
|
||||
</a>
|
||||
|
||||
@ -4,8 +4,10 @@
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"><?= $page_name; ?></h4>
|
||||
<p class="sub-header"> </p>
|
||||
<form action="<?= base_url()."user_synchronization"; ?>" method="post">
|
||||
|
||||
<?php if (session()->getFlashdata('success')): ?>
|
||||
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
|
||||
<?php endif; ?>
|
||||
<form action="<?= base_url()."user_synchronization"; ?>" method="post">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
|
||||
@ -3,10 +3,13 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="float-right">
|
||||
<a href="user_page/0" class="btn btn-primary"><i class="ri-user-add-line"></i> Add New </a>
|
||||
<a href="<?= base_url()."user_page/0"; ?>" class="btn btn-primary"><i class="ri-user-add-line"></i> Add New </a>
|
||||
</div><!-- end col-->
|
||||
<br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
<?php if (session()->getFlashdata('success')): ?>
|
||||
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="table-responsive">
|
||||
<!-- <table class="table table-borderless table-hover table-centered m-0"> -->
|
||||
<!-- <table id="alternative-page-datatable" class="table table-borderless table-hover table-centered m-0"> -->
|
||||
@ -35,7 +38,8 @@
|
||||
$class = 'badge badge-soft-danger';
|
||||
$message = 'In-Active';
|
||||
}
|
||||
$edit_page_route = "user_page/".$row['user_id'];
|
||||
$edit_page_route = base_url()."user_page/".$row['user_id'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $row['first_name'].' '.$row['last_name'] ; ?></td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user