Korjaa captcha race condition + paranna SMTP-debuggausta
Captcha: loadBranding() ensin, sitten captcha+auth, jotta sessio-cookie on luotu ennen captcha-latausta (estää eri sessiot rinnakkaisilla kutsuilla). SMTP-testi: lisää salasanavihje (3 ensimmäistä + 2 viimeistä merkkiä), override-kentät joilla voi testata eri tunnuksilla suoraan ilman DB:tä. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
13
api.php
13
api.php
@@ -2996,20 +2996,33 @@ switch ($action) {
|
||||
'smtp_encryption' => $mailbox['smtp_encryption'] ?? '',
|
||||
'smtp_from_email' => $mailbox['smtp_from_email'] ?? '',
|
||||
];
|
||||
// Override: käyttäjä voi antaa tunnukset suoraan testiin (ohittaa DB:n)
|
||||
$overrideUser = trim($input['override_user'] ?? '');
|
||||
$overridePass = $input['override_pass'] ?? '';
|
||||
// Laske fallback-arvot
|
||||
$effectiveUser = $mailbox['smtp_user'] ?? '';
|
||||
if ($effectiveUser === '') $effectiveUser = $mailbox['imap_user'] ?? '';
|
||||
if ($effectiveUser === '') $effectiveUser = $mailbox['smtp_from_email'] ?? '';
|
||||
$effectivePass = $mailbox['smtp_password'] ?? '';
|
||||
if ($effectivePass === '') $effectivePass = $mailbox['imap_password'] ?? '';
|
||||
// Jos override annettu, käytä sitä
|
||||
$usingOverride = false;
|
||||
if ($overrideUser !== '') { $effectiveUser = $overrideUser; $usingOverride = true; }
|
||||
if ($overridePass !== '') { $effectivePass = $overridePass; $usingOverride = true; }
|
||||
$host = $mailbox['smtp_host'] ?? '';
|
||||
$port = (int)($mailbox['smtp_port'] ?? 587);
|
||||
$encryption = $mailbox['smtp_encryption'] ?? 'tls';
|
||||
// Salasana-vihje: näytä ensimmäiset 3 ja viimeiset 2 merkkiä
|
||||
$passHint = strlen($effectivePass) > 5
|
||||
? substr($effectivePass, 0, 3) . '***' . substr($effectivePass, -2)
|
||||
: (strlen($effectivePass) > 0 ? '***(' . strlen($effectivePass) . ' merkkiä)' : '(tyhjä)');
|
||||
|
||||
$result = [
|
||||
'db_values' => $dbInfo,
|
||||
'effective_user' => $effectiveUser,
|
||||
'effective_pass_hint' => $passHint,
|
||||
'effective_pass_len' => strlen($effectivePass),
|
||||
'using_override' => $usingOverride,
|
||||
'steps' => [],
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user