fix(auth): la deconnexion retombe sur / plutot que /login
All checks were successful
All checks were successful
RequireAuth.tsx affiche deja la LandingPage publique pour un visiteur deconnecte exactement sur / (issue #41) — seul handleLogout naviguait encore explicitement vers /login. Change juste la destination de navigate() ; aucun autre changement necessaire. Scenario Cypress mis a jour en consequence (le pas existant "the URL should be the home page" suffit, pas besoin d'un nouveau pas). Verifie en local, suite complete : pnpm lint, pnpm --filter web build, pnpm run e2e (139/139, apres avoir nettoye un process vite zombie sur le port 5173 laisse par une precedente invocation cypress dans cette meme session — voir dev-environment-gotchas pour le detail). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
7cbd4944bd
commit
21cd8f014d
2 changed files with 9 additions and 4 deletions
|
|
@ -51,7 +51,7 @@ Feature: Signup and login
|
||||||
Then the login request should have been made
|
Then the login request should have been made
|
||||||
And I should see "Email ou mot de passe incorrect"
|
And I should see "Email ou mot de passe incorrect"
|
||||||
|
|
||||||
Scenario: Logging out returns to the login page
|
Scenario: Logging out returns to the landing page
|
||||||
Given I am signed in as "Alice" "Martin"
|
Given I am signed in as "Alice" "Martin"
|
||||||
And my household id is 1
|
And my household id is 1
|
||||||
And the planning request returns nothing
|
And the planning request returns nothing
|
||||||
|
|
@ -60,4 +60,4 @@ Feature: Signup and login
|
||||||
And I open the account menu
|
And I open the account menu
|
||||||
And I click the button "Se déconnecter"
|
And I click the button "Se déconnecter"
|
||||||
Then the logout request should have been made
|
Then the logout request should have been made
|
||||||
And the URL should include "/login"
|
And the URL should be the home page
|
||||||
|
|
|
||||||
|
|
@ -201,12 +201,17 @@ function AccountMenu() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
|
||||||
/** Ends the session and returns to the login page. */
|
/**
|
||||||
|
* Ends the session and returns to `/` — `RequireAuth` shows the public
|
||||||
|
* {@link LandingPage} there for a logged-out visitor (issue #41), so this
|
||||||
|
* naturally lands on the marketing page rather than straight back at the
|
||||||
|
* login form.
|
||||||
|
*/
|
||||||
async function handleLogout() {
|
async function handleLogout() {
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
try {
|
try {
|
||||||
await logout();
|
await logout();
|
||||||
void navigate("/login");
|
void navigate("/");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Rethrown as-is — `AuthContext`'s `logout` already documents itself
|
// Rethrown as-is — `AuthContext`'s `logout` already documents itself
|
||||||
// as throwing `ApiError` on failure; this handler just isn't allowed
|
// as throwing `ApiError` on failure; this handler just isn't allowed
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue