Fix: password signup shows JSON parse error when MAIL_URL is configured#10519
Merged
ArtyomSavchenko merged 1 commit intohcengineering:developfrom Feb 19, 2026
Merged
Conversation
|
Connected to Huly®: UBERF-15572 |
…onfigured When signing up with a password on deployments with MAIL_URL set, the account service returns token: undefined to enforce email confirmation. SignupForm.svelte was calling logIn() unconditionally, which triggered PUT /cookie without an Authorization header, returning a 401 with an unparseable body and leaving the user stuck on the signup page. - Guard logIn() in SignupForm.svelte with `result.token != null`, matching the pattern already used in doLoginNavigate() in utils.ts - Fix PUT /cookie 401 response to use Koa's ctx.status/ctx.body instead of raw ctx.res.writeHead/end, so the error body is correctly serialized - Add unit tests for the token guard logic Fixes hcengineering#10518 Signed-off-by: Yulian Diaz <5605867+spatialy@users.noreply.github.com>
5986161 to
f685807
Compare
ArtyomSavchenko
approved these changes
Feb 19, 2026
Member
|
@spatialy Thanks for your contribution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #10518
When signing up with a password on deployments where
MAIL_URLis configured, the account service returnstoken: undefinedto enforce email confirmation.SignupForm.sveltewas callinglogIn()unconditionally — this triggeredPUT /cookiewith noAuthorizationheader, the server returned 401 with an unparseable body, and the client crashed with "Unknown error: Unexpected token", leaving users stuck on the signup page even though their account was created successfully.SignupForm.svelte: guardlogIn()withresult.token != null, matching the pattern already used indoLoginNavigate()inutils.tsserver/account-service/src/index.ts: fixPUT /cookie401 response to use Koa'sctx.status/ctx.bodyinstead of rawctx.res.writeHead()/ctx.res.end(), so the JSON error body is correctly serializedsignupTokenGuard.test.ts: unit tests covering the token guard logic for all cases (undefined token, absent token, present token, null result)Test plan
MAIL_URLset to a real or dummy SMTP URLPUT /cookieis not called in the network tab (token is undefined, sologIn()is skipped)MAIL_URL— sign up with password should still calllogIn()and proceed to workspace selection as beforecurl -X PUT http://localhost:3000/cookie→ should return valid JSON{"error":{...}}with HTTP 401