Skip to content

fix(invitation): handle existing users - #6146

Open
endenis wants to merge 1 commit into
mainfrom
fix/BIL-534/invitations
Open

endenis wants to merge 1 commit into
mainfrom
fix/BIL-534/invitations

Conversation

@endenis

@endenis endenis commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Context

Accepting an invitation does not handle existing users correctly.

Description

  • Add a flow for an email that already has an account. It requires the password of that account and only adds the membership.
  • Authenticated users accept with the new joinOrganization mutation.
  • acceptInvite keeps email as an optional ignored argument, so this backend fix can be deployed before the frontend fix.

@endenis endenis self-assigned this Aug 13, 2026
@endenis
endenis force-pushed the fix/BIL-534/invitations branch from 293b76b to 3f2ca50 Compare August 13, 2026 16:20
@endenis
endenis marked this pull request as ready for review August 13, 2026 17:28
Comment thread app/models/user.rb
end

def login_method_allowed?(login_method)
active_organizations.pluck(:authentication_methods).flatten.uniq.include?(login_method)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if user belongs to two organizations;

org A allows password/google authentication methods,
org B allows okta only (or whatever authentication method that is not listed in orga A allowed ones).

should user be able to login and have access to both organizations (A and B) when authenticating with a method that is only allowed by one of them?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ancorcruz good question!

Right now it's already the case in backend on production: users can access both organizations even when only one of them allows password authentication. I am not looking into changing this behavior as part of this fix.

Long term we should consider limiting access by used sign in method in both backend and frontend.
The frontend already partially prevents this using accessibleByCurrentSession, but it does not cover every route and the backend does not enforce it.

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