Commit afb0d96f authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix smoke test auth: use correct credentials and username field

- Default to admin/ClubManagement superadmin account
- Login form uses 'username' field, not 'email'
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 2a6d61a6
...@@ -16,14 +16,14 @@ $isCli = php_sapi_name() === 'cli'; ...@@ -16,14 +16,14 @@ $isCli = php_sapi_name() === 'cli';
// ─── Configuration ────────────────────────────────────────────────────────── // ─── Configuration ──────────────────────────────────────────────────────────
if ($isCli) { if ($isCli) {
$baseUrl = $argv[1] ?? getenv('APP_URL') ?: 'http://localhost'; $baseUrl = $argv[1] ?? getenv('APP_URL') ?: 'http://localhost';
$adminEmail = $argv[2] ?? getenv('ADMIN_EMAIL') ?: 'admin@club.com'; $adminEmail = $argv[2] ?? getenv('ADMIN_EMAIL') ?: 'admin';
$adminPassword = $argv[3] ?? getenv('ADMIN_PASSWORD') ?: 'admin123'; $adminPassword = $argv[3] ?? getenv('ADMIN_PASSWORD') ?: 'ClubManagement';
} else { } else {
// Browser mode — auto-detect URL and use session auth // Browser mode — auto-detect URL and use session auth
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; $scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$baseUrl = $scheme . '://' . ($_SERVER['HTTP_HOST'] ?? 'localhost'); $baseUrl = $scheme . '://' . ($_SERVER['HTTP_HOST'] ?? 'localhost');
$adminEmail = $_POST['email'] ?? $_GET['email'] ?? 'admin@club.com'; $adminEmail = $_POST['email'] ?? $_GET['email'] ?? 'admin';
$adminPassword = $_POST['password'] ?? $_GET['password'] ?? 'admin123'; $adminPassword = $_POST['password'] ?? $_GET['password'] ?? 'ClubManagement';
} }
$baseUrl = rtrim($baseUrl, '/'); $baseUrl = rtrim($baseUrl, '/');
...@@ -167,7 +167,7 @@ curl_setopt_array($ch, [ ...@@ -167,7 +167,7 @@ curl_setopt_array($ch, [
CURLOPT_COOKIEFILE => $cookieFile, CURLOPT_COOKIEFILE => $cookieFile,
CURLOPT_POST => true, CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query([ CURLOPT_POSTFIELDS => http_build_query([
'email' => $adminEmail, 'username' => $adminEmail,
'password' => $adminPassword, 'password' => $adminPassword,
'_csrf_token' => $csrfToken, '_csrf_token' => $csrfToken,
]), ]),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment