mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-17 18:05:42 +02:00
When MAIL_URL is configured the account service intentionally returns token: undefined to enforce email confirmation before granting access. SignupForm.svelte was calling logIn() unconditionally, which triggered PUT /cookie with no Authorization header. The cookie endpoint returned a 401 whose response body was not parseable as JSON, crashing the client with "Unexpected token 'N', 'Not Found' is not valid JSON". The account was created successfully but the user was stuck on the signup page. - Guard logIn() with `result.token != null`, matching the pattern already used in doLoginNavigate() in utils.ts - Fix PUT /cookie 401 response to use ctx.res.writeHead + ctx.res.end with the JSON body inline, consistent with the rest of the file. Previously ctx.body was set (Koa pattern) then ctx.res.end() was called with no body (raw Node pattern), so the body was never sent. - Add unit tests for the token guard logic Fixes #10518 Signed-off-by: Don Kendall <kendall@donkendall.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>