feat: detect CORS errors and show actionable guidance on login

Distinguish CORS-blocked requests from genuine network failures using
a no-cors probe, so users deploying via Docker see a specific message
pointing to their JMAP server's CORS settings instead of a misleading
"unable to reach the server" error.
This commit is contained in:
Matthieu MALVACHE
2026-02-23 18:21:23 +01:00
committed by Matthieu MALVACHE
parent a0bb200da4
commit 913f673f73
12 changed files with 23 additions and 3 deletions
+3 -1
View File
@@ -98,7 +98,9 @@ export const useAuthStore = create<AuthState>()(
let errorKey = 'generic';
if (error instanceof Error) {
if (error.message.includes('Invalid username or password') ||
if (error.message === 'CORS_ERROR') {
errorKey = 'cors_blocked';
} else if (error.message.includes('Invalid username or password') ||
error.message.includes('401') ||
error.message.includes('Unauthorized')) {
errorKey = 'invalid_credentials';