Issues with Email Verification Redirect in Filament/Laravel Setup

Hi everyone,

I'm facing an issue in my Filament + Laravel project related to email verification. After verifying an email, the user is redirected to the login page instead of the intended success page. I've tried several approaches, including Laravel's default verification, a custom VerificationController, and Filament's built-in methods, but nothing has worked.

Key Details:
Custom Controller: Handles verification but fails to redirect correctly.
Filament Setup: Tried reverting to Filament's ->emailVerification() method, no change.
Simplified Routes: Used basic Laravel routes, issue persists.
Problem:
Users are redirected to the login page instead of the success page (/verification-success) after verifying their email.

Code Fragments:
VerificationController:
<?php
public function verify(Request $request, $id, $hash)
{
    $user = Auth::user();
    if ($id != $user->getKey() || !hash_equals($hash, sha1($user->getEmailForVerification()))) {
        return Redirect::route('login')->with('error', 'Invalid verification link.');
    }
    if ($user->markEmailAsVerified()) {
        event(new Verified($user));
    }
    return redirect($this->redirectTo)->with('success', 'Your email has been verified successfully.');
}

Email Verification Class:
class EmailVerification extends EmailVerificationPrompt
{
    public function mount(): void
    {
        if ($this->getVerifiable()->hasVerifiedEmail()) {
            redirect()->route('custom.verification.success')->send();
        }
    }

    public function fulfillVerification(EmailVerificationRequest $request)
    {
        $request->fulfill();
        return redirect()->route('custom.verification.success');
    }
}


Has anyone experienced something similar? Any suggestions would be greatly appreciated!

Thanks!
Was this page helpful?