feat(organizations): disable personal account for new users joining via invite - #4447
Merged
Conversation
…ia invite When a brand-new account is created specifically to accept an organization invite, set personal_account_disabled to true on join. Existing users keep their current value.
Replace the broad session-level isNewUser flag with a deterministic check: disable the personal account only when the invitation predates the account, i.e. the account was created because of an already-pending invite. This avoids disabling personal accounts for users who signed up independently and are later invited to an organization.
RSO
marked this pull request as ready for review
July 8, 2026 08:56
jeanduplessis
approved these changes
Jul 8, 2026
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryReviewed the invite-recency heuristic that disables a new user's personal account and found no correctness, security, or migration issues in the changed lines. Files Reviewed (2 files)
Reviewed by claude-sonnet-5-20260630 · Input: 36 · Output: 15.3K · Cached: 1.1M Review guidance: REVIEW.md from base branch |
RSO
added a commit
that referenced
this pull request
Jul 31, 2026
The invite flow (#4447) disables personal_account_disabled for accounts created specifically to join an org, but the SSO JIT provisioning path never did, so brand-new SSO signups kept the schema default of false. Mirror the invite behavior in addSsoUserToOrganization: when a brand-new account is provisioned via SSO and the membership is inserted, disable the personal account within the same transaction. Existing users who authenticate through SSO keep their current value.
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
personal_account_disabled = truefor brand-new accounts that are created specifically to accept an organization invite, at the moment they join.personal_account_disabledvalue.Implementation
acceptOrganizationInvitegains anisNewUserparameter (defaultfalse). When a new membership is inserted andisNewUseris true, it updates the user'spersonal_account_disabledtotruewithin the same transaction. The "already a member" path is unaffected.session.isNewUser, which is set at signup time and propagated through the JWT/session, so it istrueexactly when the account was just created andfalsefor existing users signing in.Testing
pnpm --filter web typecheckorganizations.test.tscovering both the new-user (disabled) and existing-user (unchanged) paths.