fix: prevent email change lockout via Filament email change verification#187
Merged
ManukMinasyan merged 5 commits intomainfrom Mar 18, 2026
Merged
fix: prevent email change lockout via Filament email change verification#187ManukMinasyan merged 5 commits intomainfrom
ManukMinasyan merged 5 commits intomainfrom
Conversation
…rification When users changed their email to an address they didn't own, the old flow immediately overwrote the email and nulled email_verified_at, locking them out of the panel with no way to revert. Now email changes go through Filament's built-in verification flow: - Email is NOT changed in the database until verified - Verification link sent to the new email address (1hr TTL) - Notice with block link sent to the old email address - User stays fully functional with their original email throughout
There was a problem hiding this comment.
Pull request overview
This PR addresses Filament panel lockouts caused by immediate email overwrites by enabling Filament’s email-change verification flow and integrating it into the custom profile update Livewire component, ensuring users.email and email_verified_at remain unchanged until verification completes.
Changes:
- Enabled
emailChangeVerification()on the Filamentapppanel. - Added interception logic in
UpdateProfileInformationto trigger Filament’s email-change verification notifications and prevent immediate DB email updates. - Expanded/adjusted profile feature tests to cover the email-change verification flow and avoid lockout regressions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| app/Providers/Filament/AppPanelProvider.php | Enables Filament email-change verification for the app panel. |
| app/Livewire/App/Profile/UpdateProfileInformation.php | Intercepts email edits to route through verification flow and keeps persisted email intact. |
| tests/Feature/Profile/UpdateUserProfileInformationTest.php | Updates existing tests and adds new cases for email-change verification behavior. |
…cation - Return early after email change verification instead of falling through to sendNotification(), which caused two stacked toast notifications - Add locale preference support matching Filament's built-in behavior - Rename method to sendEmailChangeVerification for clarity - Extract repeated user setup in email change verification tests
The User model doesn't implement HasLocalePreference, so the instanceof check was dead code causing a PHPStan error in CI.
Match Filament's core approach: strip email from data and continue saving other fields (name, photo) instead of early-returning. Also address Copilot review feedback: add email assertion to photo test and on-demand notification assertion to same-email test.
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
emailChangeVerification()on the app panelUpdateProfileInformationLivewire componentemail_verified_atstays intact throughout -- no lockoutProblem
When a user changed their email to an address they didn't own (typo, wrong address), the previous flow immediately overwrote
emailand setemail_verified_at = null. Filament'semailVerification()middleware then locked them out of the panel, with no way to access the profile page to revert the change.Changes
AppPanelProvider: Added->emailChangeVerification()to panel configUpdateProfileInformation: AddedhandleEmailChangeVerification()that intercepts email changes, sends verification/notice notifications via Filament's built-in flow, and resets the form email to the current value so the Fortify action never triggers the dangerous immediate overwriteTest plan
email_verified_atintact, user not locked out