Enhance user actions with CSRF protection and POST requests

Added CSRF protection and enforced POST requests for user delete and toggle status actions in UserController. Updated the users index view to use JavaScript for submitting POST forms with CSRF tokens for these actions, improving security and user experience. Also improved login success messages to include the user's full name.
This commit is contained in:
Hosteroid
2025-12-15 17:48:55 +02:00
parent bcd956a495
commit 1e98b8a047
4 changed files with 64 additions and 5 deletions

View File

@@ -295,7 +295,7 @@ class TwoFactorController extends Controller
'method' => $method
]);
$_SESSION['success'] = 'Login successful!';
$_SESSION['success'] = 'Login successful! Welcome back, ' . htmlspecialchars($user['full_name']) . '.';
$this->redirect('/');
} else {
$_SESSION['error'] = 'Invalid verification code. Please try again.';