How can I change the action after changing the password?
After I submit the new password, I get a 404 error, but I checked the system and the password was successfully changed, so it might just be a redirect issue.
How can I change that behavior?


2 Replies
it is validation error
you should check the input validation method
The problem is that I didn’t change anything in that method, and the error says it can’t find something — probably a route or something similar — but all I did was:
passwordReset(RequestPasswordReset::class)
and
<?php
namespace App\Notifications;
use Filament\Facades\Filament;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Lang;
class CustomResetPasswordNotification extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*/
public function __construct(private readonly string $token)
{
//
}
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*/
public function toMail($notifiable)
{
return (new MailMessage)
->subject(Lang::get('Reset Password Notification'))
->view('emails.reset-password', [
'url' => $this->resetUrl($notifiable),
]);
}
protected function resetUrl(mixed $notifiable): string
{
return Filament::getResetPasswordUrl($this->token, $notifiable);
}
/**
* Get the array representation of the notification.
*
* @return array<string, mixed>
*/
public function toArray(object $notifiable): array
{
return [
//
];
}
}
and
<?php
namespace App\Filament\Pages\Auth;
use App\Notifications\CustomResetPasswordNotification;
use Exception;
use Filament\Facades\Filament;
use Filament\Notifications\Notification;
use Illuminate\Support\Facades\Password;
use Illuminate\Contracts\Auth\CanResetPassword;
use DanHarrin\LivewireRateLimiting\Exceptions\TooManyRequestsException;
use Filament\Pages\Auth\PasswordReset\RequestPasswordReset as BaseRequestPasswordReset;
class RequestPasswordReset extends BaseRequestPasswordReset
{
public function request(): void
{
try {
$this->rateLimit(2);
} catch (TooManyRequestsException $exception) {
Notification::make()
->title(__('filament-panels::pages/auth/password-reset/request-password-reset.notifications.throttled.title', [
'seconds' => $exception->secondsUntilAvailable,
'minutes' => ceil($exception->secondsUntilAvailable / 60),
]))
->body(array_key_exists('body', __('filament-panels::pages/auth/password-reset/request-password-reset.notifications.throttled') ?: []) ? __('filament-panels::pages/auth/password-reset/request-password-reset.notifications.throttled.body', [
'seconds' => $exception->secondsUntilAvailable,
'minutes' => ceil($exception->secondsUntilAvailable / 60),
]) : null)
->danger()
->send();
return;
}
$data = $this->form->getState();
$status = Password::broker(Filament::getAuthPasswordBroker())->sendResetLink(
$data,
function (CanResetPassword $user, string $token): void {
if (! method_exists($user, 'notify')) {
$userClass = $user::class;
throw new Exception("Model [{$userClass}] does not have a [notify()] method.");
}
$notification = new CustomResetPasswordNotification($token);
$user->notify($notification);
},
);
if ($status !== Password::RESET_LINK_SENT) {
Notification::make()
->title(__($status))
->danger()
->send();
return;
}
Notification::make()
->title(__($status))
->success()
->send();
$this->form->fill();
}
}