Having problems with email verification

I'm trying to create a user, send them a verification email, and then upon them clicking the link in the email, sending them to a page to set a password. I have multiple panels where I need to create users from, so I'm not sure if that's causing a problem. I can send the verification email just fine like so:
protected function afterCreate(): void
{
$user = $this->getRecord();
$notification = new VerifyEmail();
$notification->url = Filament::getVerifyEmailUrl($user);

$user->notify($notification);
}
protected function afterCreate(): void
{
$user = $this->getRecord();
$notification = new VerifyEmail();
$notification->url = Filament::getVerifyEmailUrl($user);

$user->notify($notification);
}
The VerifyEmail class is my own implementation extending the default Filament one. I get the verification email just fine, but when I click the link, it just seems to redirect to the login page immediately. I'm thinking it has something to do with the panel being included in the verification link. Here's an example of what I'm seeing in the link:
http://localhost/admin/email-verification/verify/35/645d8a10da94348e6c49f7191ffc2b0c42e4904f?expires=1709399812&signature=0540883a3d032889c33455569166a6453405f651ee3f937c7f4ef5d56dafab96
http://localhost/admin/email-verification/verify/35/645d8a10da94348e6c49f7191ffc2b0c42e4904f?expires=1709399812&signature=0540883a3d032889c33455569166a6453405f651ee3f937c7f4ef5d56dafab96
There are no errors, and the email_verified_at field in the DB isn't updated, so it's like nothing happens. Also, I want to customize this url to send them to a form to set their password. How can I accomplish this? I'm having trouble working within the confines of the existing email verification system and not fully understanding how I can tap into and customize that process.
4 Replies
Jon Mason
Jon MasonOP10mo ago
Tried swapping out my implementation of VerifyEmail with just the stock Filament one and I get the same result. I was also trying to use my own EmailVerificationController class and was referencing that in my Admin panel (and the other panel where I need that functionality) like so:
->emailVerification(EmailVerificationController::class)
->emailVerification(EmailVerificationController::class)
I tried swapping that out with the default Filament one to troubleshoot and I'm getting the same result. Bump. Hoping someone has some ideas.
awcodes
awcodes10mo ago
I wonder if it’s an issue with localhost as the domain.? Like maybe some weird session thing where the tokens don’t match.
Jon Mason
Jon MasonOP10mo ago
possibly? I can maybe see if I can use the IP in the url..
awcodes
awcodes10mo ago
I’d try with something like valet or herd. Then it’s least a valid domain. It may not be the issue. But it the first thing that came to mind since it can cause other issues.
Want results from more Discord servers?
Add your server