Commit 253a5ce
authored
Scope the passwordless invite lookup to its organization (#4025)
`OrganizationRole.create_passwordless` reuses an outstanding invite
instead of creating a second role for the same person —
`CallbackJobs::AfterUserCreateJob` can reach it for a user who was
already invited. But it found that invite with `find_by_invited_email`,
no organization in the lookup, so an invite at *any* organization
matched: the org being joined silently got no role, and the caller was
handed a role belonging to somewhere else.
`Saml::AssertionProcessor#provision_user` reads `.user` off the return
value, so an SSO login for a previously-invited email provisions against
the wrong org.
- **The lookup takes `organization_id`.** All three callers already pass
it.
- **It normalizes the email the way `set_calculated_attributes` stores
it**, so an invite recorded as `Person@Example.com` still matches and
isn't duplicated.1 parent 804ed24 commit 253a5ce
2 files changed
Lines changed: 38 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
47 | 81 | | |
48 | 82 | | |
49 | 83 | | |
| |||
0 commit comments