Email Verification Problem

I'm having a problem with new users verifying their email. I have my app set up so that I can create new users and I'm using the "MustVerifyEmail" contract to send them a verification email when I've created them. However, I'm having a problem with the link they must click on to verify their email.
Below is the code for the route as per Laravel's docs. However, in my user model I have the canAccessPanel method set to only allow users that have verified their email. So when a user clicks on the link in the email and logs in, they get a 403 | Forbidden error.
I'm assuming that the canAccessPanel method is preventing an unverified email from verifying their email. Can anybody help me figure out how to get around this issue?
use Illuminate\Foundation\Auth\EmailVerificationRequest;

Route::get('/email/verify/{id}/{hash}', function (EmailVerificationRequest $request) {
$request->fulfill();

return redirect('/home');
})->middleware(['auth', 'signed'])->name('verification.verify');
use Illuminate\Foundation\Auth\EmailVerificationRequest;

Route::get('/email/verify/{id}/{hash}', function (EmailVerificationRequest $request) {
$request->fulfill();

return redirect('/home');
})->middleware(['auth', 'signed'])->name('verification.verify');
2 Replies
bahamagician
bahamagicianOP16mo ago
It just works now. No idea what changed or why but I'll take it.
ocram82
ocram8216mo ago
hi @bahamagician ! can you tell me how do you solve this? thanks

Did you find this page helpful?