Skip to content

Sprint 7 · M5: Settings page (change password, privacy, theme) + O9 clearCookie fix - #70

Merged
SumitGauswami merged 2 commits into
mainfrom
sprint7-m5-settings
Nov 21, 2026
Merged

SumitGauswami merged 2 commits into
mainfrom
sprint7-m5-settings

Conversation

@aarohi-mehta

@aarohi-mehta aarohi-mehta commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does

Sprint 7 · M5: adds a Settings page, opened from the sidebar and the account menu, with change password (old password required, other sessions logged out), the privacy switches moved here from My profile, and a theme choice. Also fixes O9, the res.clearCookie deprecation in auth.js.

User stories / requirements: Sprint 7 M5 (Settings page), O9

Changes

  • New page /settings (SettingsPage.jsx), opened from the sidebar under My profile, the account menu, the command palette or the shortcut G then S. It has four sections: Account, Change password, Privacy, Appearance.
  • Change password: POST /api/settings/password (new routes/settings.js, rules in lib/passwordChangeRules.js)
    • The current password is required. The new one must be 8–128 characters and different from the current one.
    • On success, every other session of the account ends at once: tokens, refresh cookies and live socket connections all stop working. This browser stays signed in. Any open password-reset link stops working too.
    • A wrong current password returns 400 with code: "current_password_wrong", not 401, so a typo does not sign the user out.
    • Rate limit: 10 wrong tries per account per 15 minutes.
  • Privacy switches (collaborator search, public portfolio) moved from My profile to Settings. My profile now shows a link to Settings instead. US-07 behaviour and its API are unchanged.
  • Theme: Dark / Light / System (follows the device's setting), saved in the browser. ThemeContext.jsx now supports system. The top-bar toggle and the "T" shortcut still work.
  • O9: the refresh cookie was cleared with maxAge. Express 4.21+ warns about this, and it also kept an empty cookie in the browser for 7 days. Every clear in auth.js now goes through one helper (clearRefreshCookie) without maxAge, so the cookie is deleted immediately.
  • Shared files other members should know about: app.js (mounts /api/settings), realtime.js (sockets store their session ID; new disconnectOtherSessions), api.js (settingsApi), App.jsx, AppShell.jsx, ProfilePage.jsx, styles.css
  • Tests:
    • Backend: rules, API, realtime, O9 cookie
    • Frontend: form rules, ChangePasswordForm, ThemeSettings, SettingsPage, AppShell
    • E2E: sprint7-settings.spec.js. The Sprint 5 privacy E2E now uses /settings.
  • README Sprint 7 table: M5 and O9 rows added

How to test it

  1. Log in. Click Settings in the sidebar, then the avatar → Settings. Both open /settings and the breadcrumb says Settings.
  2. Enter a wrong current password and a valid new one (twice). You see "Your current password is not correct." and you stay signed in.
  3. Try a new password that equals the current one, one shorter than 8 characters, and a confirm box that doesn't match. Each shows a clear message and nothing is sent.
  4. Log in to the same account in a second browser (or an incognito window). In the first browser, change the password correctly. You see "…1 other session was signed out."
    • The second browser goes to the login page on its next click.
    • The first browser stays signed in, even after a reload.
    • The old password no longer logs in; the new one does.
  5. In Privacy, turn the switches off and save, then reload. They stay off. My profile no longer shows the switches, and the portfolio panel says it is private.
  6. Under Theme, pick Light, then Dark, then System. Each applies at once and survives a reload.
  7. Log out and watch the backend terminal. There is no res.clearCookie: Passing "options.maxAge" is deprecated warning.

Checklist

  • Branched from the latest main and merged main again just before opening this PR
  • npm test passes in backend/ and frontend/
  • npm run build passes in frontend/
  • npm run lint shows no errors (run in the repository root)
  • Files I created or rewrote are formatted: npm run format -- <file> <file> (repository root)
  • New or changed behaviour has tests (backend and/or frontend)
  • README updated if an API, setting or command changed
  • No secrets, .env files, node_modules or dist in the diff
  • Only my part of the sprint plan is in this PR (nothing extra)

Screenshots (UI changes)

Screenshot 2026-11-21 at 5 42 28 PM Screenshot 2026-11-21 at 5 43 24 PM Screenshot 2026-11-21 at 5 43 52 PM Screenshot 2026-11-21 at 5 45 16 PM

@vercel

vercel Bot commented Nov 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
devorbit Ready Ready Preview Nov 21, 2026 8:44am UTC

@SumitGauswami
SumitGauswami merged commit 3aa8cee into main Nov 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants