Closed renatofrota closed 5 months ago
Thank you for using our package.
When using oauth, one most often trusts a third party to verify a user is who they say they are. In most cases, it would not be logical to have users verify their mail (again) in the application.
For this reason, a custom Registered event is triggered. In this event one can choose to set the email to verified (so regular registered users do have to verify their mail), dispatch laravel’s default registered event and/or trigger a verification mail.
Thank you.
I am using providers that do email validation so I went the first option: mark email as verified on signups (Registered
event) and Socialite connections (SocialiteUserConnected
event) to also cover the cases where the user is registered first (the normal way) then login using socialite.
php artisan make:listener MarkSocialiteUserAsVerified --event=Registered
customized app/Listeners/MarkSocialiteUserAsVerified.php
like this:
<?php
namespace App\Listeners;
use DutchCodingCompany\FilamentSocialite\Events\Registered;
use DutchCodingCompany\FilamentSocialite\Events\SocialiteUserConnected;
use DutchCodingCompany\FilamentSocialite\Models\Contracts\FilamentSocialiteUser as FilamentSocialiteUserContract;
class MarkSocialiteUserAsVerified
{
/**
* Create the event listener.
*/
public function __construct()
{
//
}
/**
* Handle the event.
*/
public function handle(Registered | SocialiteUserConnected $event): void
{
if ($event->socialiteUser instanceof FilamentSocialiteUserContract) {
$event->socialiteUser->getUser()->markEmailAsVerified();
}
}
}
My suggestion: it could be a plugin option (global or per provider) to mark email as verified automatically on sign ups and Socialite connections (1st login using Socialite).
Hello,
When e-mail verification is required, it's expected the verification link is sent automatically. Currently, the user is just redirected to the verification pending screen (where it's stated the e-mail has already been sent - while it's not).