-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Closed
Description
Laravel Version
= 9.52.16
PHP Version
8.1.21
Database Driver & Version
MySQL 8.0.33
Description
After trying to implement Illuminate\Auth\Listeners\SendEmailVerificationNotification listener I noticed that
if ($event->user instanceof MustVerifyEmail && ! $event->user->hasVerifiedEmail()) {
$event->user->sendEmailVerificationNotification();
};
condition always return false as a result.
After examining the User model, I noticed that it extends the Illuminate\Foundation\Auth\User model, where the Illuminate\Contracts\Auth\MustVerifyEmail interface which is implemented by Illuminate\Auth\MustVerifyEmail trait, seems to be missing.
Steps To Reproduce
Actual version that I'm using (9.52.16) but as I see this gap is in latest version also.
After adding the MustVerifyEmail interface the problem was solved:
Actual version:
<?php
namespace Illuminate\Foundation\Auth;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\MustVerifyEmail;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\Access\Authorizable;
class User extends Model implements
AuthenticatableContract,
AuthorizableContract,
CanResetPasswordContract
{
use Authenticatable, Authorizable, CanResetPassword, MustVerifyEmail;
}
Modified version:
<?php
namespace Illuminate\Foundation\Auth;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\MustVerifyEmail as MustVerifyEmailTrait;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\Access\Authorizable;
class User extends Model implements
AuthenticatableContract,
AuthorizableContract,
CanResetPasswordContract,
MustVerifyEmail
{
use Authenticatable, Authorizable, CanResetPassword, MustVerifyEmailTrait;
}
Metadata
Metadata
Assignees
Labels
No labels