preserve client session after partial load failure
Client checks / checks (push) Canceled after 0s
Client dependency and security checks / audit (push) Canceled after 0s

This commit is contained in:
2026-10-25 09:44:07 +01:00
parent 092b58cdc2
commit bc06d323c7
+8 -1
View File
@@ -350,7 +350,10 @@
headers: { 'content-type': 'application/json' }, headers: { 'content-type': 'application/json' },
body: JSON.stringify({ username, password }), body: JSON.stringify({ username, password }),
}); });
if (!response.ok) throw new Error('Your username or password may be incorrect.'); if (!response.ok) {
const failure = (await response.json().catch(() => undefined)) as { message?: string; code?: string } | undefined;
throw new Error(failure?.message || failure?.code || 'The server could not process the login.');
}
const result: { session_token: string; must_replace_credentials: boolean } = await response.json(); const result: { session_token: string; must_replace_credentials: boolean } = await response.json();
sessionToken = result.session_token; sessionToken = result.session_token;
authenticated = true; authenticated = true;
@@ -359,7 +362,11 @@
authError = 'Login succeeded, but the session could not be stored in the Linux keyring.'; authError = 'Login succeeded, but the session could not be stored in the Linux keyring.';
}); });
connectionState = 'CONNECTED'; connectionState = 'CONNECTED';
try {
await loadAuthenticatedData(); await loadAuthenticatedData();
} catch {
authError = 'Login succeeded, but some dashboard data could not be loaded.';
}
if (!mustReplaceCredentials) password = ''; if (!mustReplaceCredentials) password = '';
if (mustReplaceCredentials) newUsername = username; if (mustReplaceCredentials) newUsername = username;
} catch (error) { } catch (error) {