fix(sign-on): reset welcome state on cancel and report a failed cancel logout
- commit
- dcb7d15e9163486518e65765e845f302dcf65afc
- author
- Kit · · 2026-09-29 06:01 UTC
- parent
- d17e56d
- signature
- SSH Unverified
SHA256:H91DFuEG4jpk5edzLA4aUKkpv4zv9Q339ipRmkph6TkThe key is unknown
1 file · +9 -3
M src/lib/components/desktop/sign-on-window.svelte +9 -3
| @@ -132,15 +132,21 @@ | |||
| 132 | 132 | // Cancelled after the credentials were sent: the server may have created a | |
| 133 | 133 | // session, so honour "Annuler" by signing out (a no-op without a session). | |
| 134 | 134 | if (step >= 2 && signOnAbort === controller) { | |
| 135 | - | await fetch('/api/session/logout', { method: 'POST' }).catch(() => {}); | |
| 136 | - | chatState.setCurrentUser(null); | |
| 135 | + | const loggedOut = await fetch('/api/session/logout', { method: 'POST' }) | |
| 136 | + | .then((res) => res.ok) | |
| 137 | + | .catch(() => false); | |
| 138 | + | // Re-sync client auth with the server either way; only claim success if the logout worked. | |
| 137 | 139 | await invalidate('app:session'); | |
| 140 | + | if (!loggedOut) error = 'Annulation impossible : tu es peut-être connecté.'; | |
| 138 | 141 | } | |
| 139 | 142 | } finally { | |
| 140 | 143 | if (signOnAbort === controller) { | |
| 141 | 144 | signOnAbort = null; | |
| 142 | 145 | desktop.signingOn = false; | |
| 143 | - | if (signal.aborted) step = 0; | |
| 146 | + | if (signal.aborted) { | |
| 147 | + | step = 0; | |
| 148 | + | signedOnAs = null; | |
| 149 | + | } | |
| 144 | 150 | } | |
| 145 | 151 | } | |
| 146 | 152 | } | |
| @@ -132,15 +132,21 @@ | |||||
| 132 | // Cancelled after the credentials were sent: the server may have created a | 132 | // Cancelled after the credentials were sent: the server may have created a | ||
| 133 | // session, so honour "Annuler" by signing out (a no-op without a session). | 133 | // session, so honour "Annuler" by signing out (a no-op without a session). | ||
| 134 | if (step >= 2 && signOnAbort === controller) { | 134 | if (step >= 2 && signOnAbort === controller) { | ||
| 135 | - | await fetch('/api/session/logout', { method: 'POST' }).catch(() => {}); | 135 | + | const loggedOut = await fetch('/api/session/logout', { method: 'POST' }) |
| 136 | - | chatState.setCurrentUser(null); | 136 | + | .then((res) => res.ok) |
| 137 | + | .catch(() => false); | |||
| 138 | + | // Re-sync client auth with the server either way; only claim success if the logout worked. | |||
| 137 | await invalidate('app:session'); | 139 | await invalidate('app:session'); | ||
| 140 | + | if (!loggedOut) error = 'Annulation impossible : tu es peut-être connecté.'; | |||
| 138 | } | 141 | } | ||
| 139 | } finally { | 142 | } finally { | ||
| 140 | if (signOnAbort === controller) { | 143 | if (signOnAbort === controller) { | ||
| 141 | signOnAbort = null; | 144 | signOnAbort = null; | ||
| 142 | desktop.signingOn = false; | 145 | desktop.signingOn = false; | ||
| 143 | - | if (signal.aborted) step = 0; | 146 | + | if (signal.aborted) { |
| 147 | + | step = 0; | |||
| 148 | + | signedOnAs = null; | |||
| 149 | + | } | |||
| 144 | } | 150 | } | ||
| 145 | } | 151 | } | ||
| 146 | } | 152 | } | ||