processing / processing/p5.js-web-editor
Double response and logic error in account settings update
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 1.7k
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 8
Description
p5.js version
No response
What is your operating system?
None
Web browser and version
No response
Actual Behavior
In updateSettings() multiple code paths send a response but do not return, so:
- Social login user setting password:
saveUser(res, user)is called (sends 200), then execution continues and can send 401. - Password update:
await saveUser(res, user)sends response, then execution falls through andsaveUser()is called again in theelseblock.
Result: "Cannot set headers after they are sent", inconsistent client state, or users seeing errors despite success.
Location: server/controllers/user.controller/authManagement.ts lines 159–201
Expected Behavior
Each code path that sends a response should return immediately. Only one response per request.
Steps to reproduce
- Log in with a social account (e.g. Google) that has no password set.
- Go to Account settings and set a new password (no current password).
- Submit the form. Observe: success response may be sent, then 401 or double-response error.
- Alternatively: log in with email/password, change password, submit. Observe possible double response or header errors.
Snippet:
// authManagement.ts - updateSettings (simplified)
if (user.password === undefined) {
user.password = req.body.newPassword;
saveUser(res, user); // sends response, no return
}
if (!req.body.currentPassword) {
res.status(401).json({ ... }); // second response
return;
}
// ...
await saveUser(res, user); // line 177 - sends response
// no return - falls through to:
} else {
await saveUser(res, user); // line 201 - sends again
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open server/controllers/user.controller/authManagement.ts and inspect updateSettings(), especially lines 159–201 and the saveUser() calls. Reproduce the social-login password-setting and password-update flows described in the issue. Done means each request sends exactly one response without a headers-already-sent error or an incorrect 401 after success.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100