Files
huly-platform/server
b426a42a4f fix(login): guard logIn() behind token check in password signup (#10518) (#10650)
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>
2026-03-19 14:48:29 +07:00
..
2025-12-18 00:40:41 +05:00
2025-12-18 00:40:41 +05:00
2025-12-18 00:40:41 +05:00
2025-12-18 00:40:41 +05:00