# Add Password Reset to a Filament Admin Panel

Yes. An agent turns on Filament's password reset for your admin panel, checks the reset table and mailer your app already has, writes Pest tests and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-password-reset/filament/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads the panel before it changes it. In a Filament app like filamentphp/demo, `composer.lock` pins `filament/filament` at `v5.10.1` on `laravel/framework ^12.0`, and there are two panels. `app/Providers/Filament/AdminPanelProvider.php` is the default one: `->id('admin')`, `->login(Login::class)`, resource and page discovery, `->databaseNotifications()`, `->spa()`, and no `passwordReset()` call, so its login screen has no way back in for someone who forgot their password. `app/Providers/Filament/AppPanelProvider.php`, the tenant panel at `/app`, already chains `->registration()->passwordReset()->emailVerification()`, which gives the agent an in-repo reference for how this codebase expects auth features to be enabled.

One line turns the feature on, and the rest of the work is checking that the app around it is ready. `Panel::passwordReset()` registers Filament's `RequestPasswordReset` and `ResetPassword` pages under the panel and adds the forgot-password link to the login page. The reset tokens go through Laravel's password broker, so the agent reads `config/auth.php`: `passwords.users` points at a table named `password_resets` with a 60-minute expiry and a 60-second throttle, and `database/migrations/2021_12_13_000002_create_password_resets_table.php` creates exactly that table. The two agree, so no migration is needed; had the config said `password_reset_tokens`, the Laravel default since version 10, the agent would have flagged the mismatch instead of guessing.

Mail is the other dependency. `app/Models/User.php` already uses `Notifiable` and implements `MustVerifyEmail`, so Filament's `ResetPassword` notification can be delivered. `config/mail.php` defaults to the `smtp` mailer, and `.env.example` points it at a `mailhog` host on port 1025 with `MAIL_FROM_ADDRESS=null`, which Laravel reads as no value and replaces with its own fallback sender; the pull request calls that out so a real sender is set before the feature meets users. `phpunit.xml` sets `MAIL_MAILER=array` and `QUEUE_CONNECTION=sync` for tests, so no message leaves the sandbox during the test run.

Tests follow the repository's own conventions. `tests/Pest.php` binds `tests/Filament` to `TestCase`, uses `RefreshDatabase`, and signs every test in as a fresh `User::factory()->create()` in `beforeEach`, and the directory is otherwise empty. The agent adds `tests/Filament/PasswordResetTest.php`: it logs out first, because a signed-in user is redirected away from auth pages; checks that the admin login page now links to the request page; uses `Notification::fake()` and Livewire's test helper to fill the request form with a seeded user's address, call the page's `request` action and assert `Notification::assertSentTo($user, ResetPassword::class)`; asserts that an unknown address sends nothing; and completes a reset with a token from `Password::broker()->createToken($user)`, then logs in with the new password. The agent runs `composer test:pest` and `composer test:phpstan` in the sandbox and pastes both.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add password reset to the admin panel of this Filament app and open a pull request. Read app/Providers/Filament/AdminPanelProvider.php, app/Providers/Filament/AppPanelProvider.php, app/Models/User.php, config/auth.php, config/mail.php, .env.example, phpunit.xml and tests/Pest.php first. Add ->passwordReset() to the admin panel the way the app panel already has it. Check that the password broker's table in config/auth.php matches a migration in database/migrations and that the User model is Notifiable; make no migration unless they disagree, and say what you found. Add tests/Filament/PasswordResetTest.php with Pest: log out first because Pest.php signs every test in, assert the admin login page links to the reset request page, fake notifications and submit the request form for a seeded user asserting Filament's ResetPassword notification was sent to them, assert an unknown email sends nothing, and complete a reset with a token from the password broker and log in with the new password. Note in the pull request that .env.example sets MAIL_FROM_ADDRESS=null and what to set instead. Run composer test:pest and composer test:phpstan and paste both outputs. Do not change the app panel, the demo Login page or any resource.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request with one added line in `app/Providers/Filament/AdminPanelProvider.php`, a new `tests/Filament/PasswordResetTest.php`, and a description that records what was checked and found: the broker table name against the migration, the `Notifiable` trait on the model, the `array` mailer in `phpunit.xml`, and the `MAIL_FROM_ADDRESS` placeholder in `.env.example`. The `composer test:pest` and `composer test:phpstan` outputs from the sandbox are pasted in full.

`.github/workflows/tests.yml` runs on every push and pull request: PHP 8.4, `composer install`, `npm ci && npm run build`, `php artisan key:generate`, an SQLite file, then `composer test:pest`. `phpstan.yml` runs Larastan alongside it. So the new tests run on the pull request without any workflow change.

A reviewer checks the forgot-password link on the admin login page, that the request form shows the same message for known and unknown addresses if that matters for their users, that a production mailer and sender address are configured, and that the 60-minute expiry and 60-second throttle in `config/auth.php` suit the admin audience. Then they merge, and the panel's users can recover their own accounts.

## Run it on every new admin panel

A team that ships a Filament panel per product sends one `POST /o/{org}/sessions` per repository with this prompt and that repository in `resources`. Each run reads its own `config/auth.php` and migrations, so an app on the `password_reset_tokens` table gets the same one-line change with a different check, and an app whose `User` lacks `Notifiable` gets the trait added and explained. Each run opens its own pull request.

Give the API key a `webhook_url` and Rush POSTs `run.completed` when each turn ends, with the `session_url` to read the pull request from. The pasted test output is in the session as well, so the reviewer sees the Pest run before opening the diff.

## Why run it on Rush?

The feature is one method call; the risk is everything around it, and a developer on a laptop tends to flip the switch, click through once with Mailhog and move on. In a Rush sandbox the agent installs the app, boots it against SQLite, drives the request and reset pages through Livewire tests with notifications faked, and keeps every command and result in the run's record, so the pull request shows the flow working rather than asserting it.

The checks are the part that transfers. Table name against migration, model trait, test mailer, sender address: the agent reads each from the file that defines it and reports it, and the same request produces the same audit on the next panel, which is how a small auth change stays boring.

## Frequently asked questions

### Do I need a new migration?

Not in this app. `config/auth.php` names the `password_resets` table and `database/migrations/2021_12_13_000002_create_password_resets_table.php` creates it. If your config says `password_reset_tokens` and no migration does, the agent adds one and says why; it never changes the table name silently.

### Will tests send real email?

No. `phpunit.xml` sets `MAIL_MAILER=array`, and the tests call `Notification::fake()` before submitting the form, then assert that Filament's `ResetPassword` notification was sent to the right user. Nothing leaves the sandbox or the CI runner.

### Why does the test log out first?

`tests/Pest.php` signs every test in `tests/Filament` in as a fresh user in `beforeEach`. Filament redirects a signed-in user away from its auth pages, so the reset test calls `Auth::logout()` before visiting the request page.

### Does the demo's prefilled login page change?

No. `app/Filament/Pages/Auth/Login.php` fills in the demo credentials in `mount()` and stays as it is. Filament adds the forgot-password link to that page on its own once the panel has `passwordReset()`.

### Can I use my own request and reset pages?

Yes. `passwordReset()` takes the two page classes as arguments, so a project with branded auth pages passes its own subclasses. The agent uses Filament's defaults unless the prompt names replacements.

## More Filament jobs

- [Add PDF Invoices to a Filament Admin Panel from a Linear Issue](https://getrush.ai/run/add-pdf-invoices/filament/)
- [Run Rector in CI for a Filament Admin Panel](https://getrush.ai/run/add-rector-to-ci/filament/)
- [Add Roles and Permissions to a Filament Admin Panel](https://getrush.ai/run/add-roles-and-permissions/filament/)

## The same job on other stacks

- [Add a Password Reset Flow to a Symfony App](https://getrush.ai/run/add-password-reset/symfony/)
- [Add Password Reset to an AdonisJS App](https://getrush.ai/run/add-password-reset/adonisjs/)
- [Add a Password Reset API to a Django REST Framework Project](https://getrush.ai/run/add-password-reset/django-rest-framework/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
