Skip to content

Updated invitation flow - #1078

Merged
korridor merged 41 commits into
mainfrom
feature/user-management
Jun 18, 2026
Merged

korridor merged 41 commits into
mainfrom
feature/user-management

Conversation

@korridor

@korridor korridor commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Moved jetstream function to REST endpoints
  • Lower case email

Checklist (DO NOT REMOVE)

Sayr 42

@codecov

codecov Bot commented May 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.12557% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.17%. Comparing base (d732064) to head (f3ec660).

Files with missing lines Patch % Lines
app/Service/Dto/UserAgentDto.php 89.13% 5 Missing ⚠️
app/Support/Base64File.php 77.77% 4 Missing ⚠️
app/Service/UserService.php 87.50% 3 Missing ⚠️
app/Filament/Resources/UserResource.php 60.00% 2 Missing ⚠️
app/Http/Controllers/Web/UserProfileController.php 96.36% 2 Missing ⚠️
app/Http/Controllers/Controller.php 0.00% 1 Missing ⚠️
app/Models/Organization.php 66.66% 1 Missing ⚠️
app/Providers/FortifyServiceProvider.php 97.22% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1078      +/-   ##
============================================
+ Coverage     89.06%   89.17%   +0.11%     
- Complexity     1875     1991     +116     
============================================
  Files           275      282       +7     
  Lines          9733     9833     +100     
============================================
+ Hits           8669     8769     +100     
  Misses         1064     1064              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@korridor
korridor force-pushed the feature/user-management branch 2 times, most recently from b68825c to 3267acb Compare May 20, 2026 14:25

$user->switchTeam($organization);

// Note: The refresh is necessary for currently unknown reasons. Do not remove it.

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.

do we know why it is needed now?

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.

Do you mean the switchTeam or the refresh?

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.

The refresh. The comment just sounded like a leftover.

@korridor korridor May 28, 2026 •

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.

Yes this might be a leftover, but I'll move the switchTeam to the UserService anyways to further reduce the dependency on Jetstream and then remove the refresh.

@Onatcer

Onatcer commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

@korridor I did change it to a session state now after all because the Inertia URL handling gets flaky once I start messing with the URLs on the client side (Inertia has its own URL state, which overrides it again). We can revisit this when we eventually migrate to a SPA and have full URL control there. E2E tests are in place so it should be an easy migration after the fact.

I also changed the logged-out redirect and added an Auth check there for the case detection. I think this is cleaner than messing with the middleware behaviour and I don't really see a reason why there shouldn't be an Auth check in this controller especially when we just use it for the determining the redirect.

Arguably, the UX path for "A different user is logged in and accepts the invite" is a bit confusing because they get a message that they accepted an invite to an organization but the logged in user cannot actually see the org (because the invite was accepted for a different user). It is probably an edge case tho.

@Onatcer

Onatcer commented May 26, 2026

Copy link
Copy Markdown
Contributor

the photo delete path was not supported, it now takes {photo: null} as delete and a missing photo key as "do not touch". seperate endpoints for photo create and delete would probably be cleaner but i think its ok for now.

@Onatcer

Onatcer commented May 26, 2026

Copy link
Copy Markdown
Contributor

@korridor there is currently no way to reset the email_pending as far as I can see. so when you change the email address but decide afterwards that you actually don't wanna change it, it just stays in email_pending forever.

we could either make it so that the endpoint resets email_pending if the email in the db === request email and email_pending !== null (and the frontend doesn't resend the email if it didn't change) or have a separate endpoint for it. in the frontend, it would be a Cancel button either way.

@Onatcer
Onatcer force-pushed the feature/user-management branch 3 times, most recently from 61ae1f2 to c8623b7 Compare May 27, 2026 17:06
@Onatcer

Onatcer commented May 27, 2026

Copy link
Copy Markdown
Contributor

profile information update and user delete are now moved to the API. I do the password check manually now in the frontend and confirm it with the fortify password.confirm route, technically it is however way easier now to just straight up delete the account with an endpoint or caused by some rogue script/extension. we could add a password check/middleware again to the delete endpoint, not sure if its really necessary tho. it would be kinda weird for an API endpoint.

@Onatcer
Onatcer force-pushed the feature/user-management branch 2 times, most recently from 71a7eeb to f32ec59 Compare May 29, 2026 15:45
@Onatcer
Onatcer marked this pull request as ready for review May 29, 2026 15:51
@Onatcer
Onatcer force-pushed the feature/user-management branch from 532d74a to 7035d5f Compare June 5, 2026 14:43
@korridor

korridor commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Before merge: merge pull requests in extensions

@korridor
korridor force-pushed the feature/user-management branch from 16dcb5d to 98bbe80 Compare June 8, 2026 15:35
@Onatcer

Onatcer commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

it looks like current_team_id is null after a user registration now (at least according to my e2e tests).

@Onatcer
Onatcer force-pushed the feature/user-management branch from 5384152 to f826474 Compare June 8, 2026 16:57
@korridor

korridor commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

it looks like current_team_id is null after a user registration now (at least according to my e2e tests).

@Onatcer Fixed in latest commit "Fixed current organization after normal registration"

@Onatcer
Onatcer force-pushed the feature/user-management branch 2 times, most recently from 1a4d858 to 3caf743 Compare June 9, 2026 14:24
Comment thread routes/web.php Resolved
@Onatcer
Onatcer force-pushed the feature/user-management branch from 49c0891 to 4ff8a72 Compare June 10, 2026 12:13
@Onatcer

Onatcer commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@korridor everything that was caught by the e2e tests is now fixed, so from what i can tell this is ready for merge.

I added one comment about the AuthenticateSession middleware that you might want to look at.

One more security related thing: Because the user delete endpoint is now in the API and does not require a password anymore, it is less protected against potential XSS attacks (the UI checks the password first but the API endpoint does not). I'm leaning towards requiring the password there again especially because the enpoint is also accessible with an API token now.

@korridor

Copy link
Copy Markdown
Contributor Author

@Onatcer Thanks.

One more security related thing: Because the user delete endpoint is now in the API and does not require a password anymore, it is less protected against potential XSS attacks (the UI checks the password first but the API endpoint does not). I'm leaning towards requiring the password there again especially because the enpoint is also accessible with an API token now.

Sounds good especially since there are a lot of self-hosters, but would the same argument be true for organization.destroy. Might be even more critical there.

@Onatcer

Onatcer commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@korridor agreed, i think adding it to both of them is a good idea. one thing we should keep in mind is that users added via other identity providers (SSO) in the future might not have a password.

Onatcer and others added 26 commits June 17, 2026 15:20
@korridor
korridor force-pushed the feature/user-management branch from 4ff8a72 to f8a2b7a Compare June 17, 2026 13:53
@korridor
korridor force-pushed the feature/user-management branch from f8a2b7a to f3ec660 Compare June 17, 2026 14:18
@korridor
korridor merged commit 6a197f7 into main Jun 18, 2026
24 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.

3 participants