new file: src/Controllers/AuthController.php

This commit is contained in:
2024-12-19 08:16:09 +02:00
parent f96c3e9337
commit 248698fda3
9 changed files with 612 additions and 103 deletions

View File

@@ -18,7 +18,7 @@
<!-- Latest compiled and minified JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap-table@1.23.5/dist/bootstrap-table.min.js"></script>
<!-- Latest compiled and minified Locales -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap-table@1.23.5/dist/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap-table@1.23.5/dist/locale/bootstrap-table-en-US.min.js"></script>
<link rel="stylesheet" type="text/css"
href="https://cdn.jsdelivr.net/npm/bootstrap-table@1.23.5/dist/extensions/filter-control/bootstrap-table-filter-control.css">
<script
@@ -58,9 +58,7 @@
<li class="nav-item">
<a class="btn text-light" onclick="initializeTable('top_ip_by_rps');">IP+RPS</a>
</li>
<li class="nav-item">
<a class="btn text-light" onclick="initializeTable('top_net_28_by_rps');">IP+RPS</a>
</li>
</ul>
@@ -196,57 +194,6 @@
function buttons() {
{if $smarty.session.user_role == 'admin'}
return {
btnAdd: {
text: 'Add new list',
icon: 'fa-plus',
event: function() {
// Prompt the user for a new list name
const newListName = prompt('Enter new list name:');
// Only proceed if the user provides a valid list name
if (newListName) {
// Define the URL where the form needs to be posted
const url = '{$smarty.env.BASEURI}/lists/create'; // Replace with actual URL
// Create a new hidden form element
const form = document.createElement('form');
form.method = 'POST';
form.action = url;
// Create hidden input to store the list name
const input = document.createElement('input');
input.type = 'hidden';
input.name = 'listName'; // The name expected by the server
input.value = newListName;
// Append the input to the form
form.appendChild(input);
// Append the form to the body to make it part of the DOM
document.body.appendChild(form);
// Submit the form automatically
form.submit();
} else {
// Handle case where user cancels or enters an empty name
alert('List creation was cancelled or name was empty.');
}
},
attributes: {
title: 'Add a new list to the table'
}
}
}
{else}
return {
}
{/if}
}
function listFormatter(value, row, index) {
var editBtn = '<a class="btn" href="{$smarty.env.BASEURI}/lists/edit/' + row.list_id + '" title="Edit"><i class="fa-solid fa-pen-to-square"></i></a> ';