feat: add expirable invite links with 7-day default expiry#188
Merged
ManukMinasyan merged 20 commits intomainfrom Mar 23, 2026
Merged
feat: add expirable invite links with 7-day default expiry#188ManukMinasyan merged 20 commits intomainfrom
ManukMinasyan merged 20 commits intomainfrom
Conversation
- Add expires_at column to team_invitations table
- Auto-set expiry from config('jetstream.invitation_expiry_days')
- Custom AcceptTeamInvitationController with expiry + email-match checks
- Friendly expired invitation landing page
- Extend invitation and copy invite link table actions
- Scheduled cleanup command for expired invitations
- 19 tests covering invite, accept, manage, and cleanup flows
There was a problem hiding this comment.
Pull request overview
Adds expiration semantics to Jetstream team invitations (default 7 days, configurable), improves UX for expired links, and introduces operational cleanup for stale invitations.
Changes:
- Add
expires_attoteam_invitations, set on invite creation, display in the pending invitations table, and provide “Extend” + “Copy Link” actions. - Replace Jetstream’s invitation acceptance endpoint with a custom controller that blocks expired invites and enforces invited-email matching.
- Add a scheduled Artisan command to purge long-expired invitations, plus new Pest coverage for the invitation lifecycle.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Feature/Teams/ManageTeamInvitationsTest.php | Adds model/action/table/command coverage around expiry + cleanup. |
| tests/Feature/Teams/InviteTeamMemberTest.php | Updates invitation tests to new Livewire components and asserts expiry is set/configurable. |
| tests/Feature/Teams/AcceptTeamInvitationTest.php | Covers accept flow for valid/expired/null-expiry/wrong-email/invalid-signature cases. |
| routes/web.php | Swaps invitation accept route to the new invokable controller. |
| resources/views/teams/invitation-expired.blade.php | Adds friendly expired-invitation page. |
| resources/views/emails/team-invitation.blade.php | Displays expiry info in invitation emails. |
| lang/en/teams.php | Adds labels/notifications for extend + copy-link actions. |
| database/migrations/2026_03_18_202956_add_expires_at_to_team_invitations_table.php | Adds nullable expires_at + index. |
| database/factories/TeamInvitationFactory.php | Adds factory defaults/states for expiry scenarios. |
| config/jetstream.php | Introduces invitation_expiry_days setting (default 7). |
| bootstrap/app.php | Schedules daily invitations:cleanup. |
| app/Models/TeamInvitation.php | Adds expires_at casting + isExpired() helper. |
| app/Livewire/App/Teams/PendingTeamInvitations.php | Shows expiry status and adds Extend/Copy Link table actions. |
| app/Http/Controllers/AcceptTeamInvitationController.php | Implements expiry + invited-email enforcement on accept. |
| app/Console/Commands/CleanupExpiredInvitationsCommand.php | Adds cleanup command for old expired invitations. |
| app/Actions/Jetstream/InviteTeamMember.php | Sets expires_at when creating invitations. |
…nup NULL invitations, remove PII from logs
…ink on Login page
…nent Instead of cramming the invitation message into the <p> subheading alongside the navigation link, render it as a visually distinct banner using Filament's Html schema component in the page content(). The subheading reverts to its default behavior (just the sign-up/in link).
Rector's EloquentMagicMethodToQueryBuilderRector rule requires User::query()->where() instead of User::where().
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
expires_atcolumn toteam_invitationstable with configurable default (7 days viaconfig('jetstream.invitation_expiry_days'))AcceptTeamInvitationControllerwith expiry check (friendly expired page) and email-match verification (403 on mismatch)diffForHumans()) or "Expired" labelinvitations:cleanupartisan command (scheduled daily) purges expired invitations older than 30 daysexpires_attreated as already expired (safe default for any legacy data)Test plan
InviteTeamMemberTest(3) — invite creates expiry, config override, cancelAcceptTeamInvitationTest(6) — accept, expired page, null expiry, wrong email, invalid sig, deletionManageTeamInvitationsTest(10) — isExpired unit tests, extend/copy actions, table display, cleanup commandCloses #94