- Fix getAllForAdmin method to not select last_login column - Fix findForAdmin method to not select last_login column - Users table doesn't have last_login column
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
// Teste simples de autenticação
|
|
require_once __DIR__ . '/vendor/autoload.php';
|
|
|
|
// Load environment
|
|
\App\Core\EnvironmentLoader::load();
|
|
|
|
// Initialize database
|
|
$db = \App\Core\DatabaseManager::getInstance();
|
|
|
|
// Test Auth class
|
|
try {
|
|
$auth = new \App\Core\Auth();
|
|
echo "Auth class loaded successfully\n";
|
|
|
|
// Check if user is logged in
|
|
$isLoggedIn = $auth->check();
|
|
echo "User logged in: " . ($isLoggedIn ? 'Yes' : 'No') . "\n";
|
|
|
|
if ($isLoggedIn) {
|
|
echo "User ID: " . $auth->id() . "\n";
|
|
echo "Is Admin: " . ($auth->isAdmin() ? 'Yes' : 'No') . "\n";
|
|
}
|
|
|
|
} catch (Exception $e) {
|
|
echo "Error with Auth: " . $e->getMessage() . "\n";
|
|
}
|
|
|
|
// Test UserModel
|
|
try {
|
|
$userModel = new \App\Modules\Users\Models\UserModel();
|
|
$users = $userModel->getAllForAdmin('', 'name', 1, 5);
|
|
echo "Users found: " . count($users) . "\n";
|
|
|
|
foreach ($users as $user) {
|
|
echo "- ID: {$user['id']}, Name: {$user['first_name']} {$user['last_name']}, Email: {$user['email']}\n";
|
|
}
|
|
|
|
} catch (Exception $e) {
|
|
echo "Error with UserModel: " . $e->getMessage() . "\n";
|
|
}
|