What really happens:
Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', function () {
(['auth:sanctum', 'verified']
when passing two arguments of laravel one of authentication and the other of verification of mail. It says: it is authenticated. 😎 and verified 🙄 ok response: Respond that the user in the table: User email_verified_at is not registered on the email activation date, that is, it has not told me that the email exists. ps passes an exception for that there is a page that you must active as a response to this ... that is, as a response to this ...
Your email is not verified even if the page is created either in vue on blade or in limewire in the auth folder.
in App\Models\User search
// use Illuminate\Contracts\Auth\MustVerifyEmail;
active:
use Illuminate\Contracts\Auth\MustVerifyEmail;
eh implements
class User extends Authenticatable implements MustVerifyEmail
now many things are missing ..
We verify that kernel is active the following parameters :
in route App\Http\Kernel.php
// 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
change:
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
in the folder Config:
config\fortify.php
this:
// Features::emailVerification(),
it
Features::emailVerification(),
And the most important of this authentication hell .. the routes:
You can do the different types of routes you choose ... but one according to your resources or project.
basic:
Route::middleware(['auth:sanctum'])->get('/dashboard', function () {
return Inertia::render('Dashboard');
})->middleware('verified')->name('dashboard');
Route::middleware(['auth:sanctum','verified'])->get('/dashboard', function () {
return Inertia::render('Dashboard');
})->name('dashboard');
a little adrenaline:
Route::group(["middleware" => ['auth:sanctum','verified']], function () {
Route::get('/dashboard', function () {
return Inertia::render('Dashboard');
// return "hola william";
})->name('dashboard');
//aca puedes segir colocando las paginas o recursos que quieres cargar mientras en usuario este autenticado y verificado...
});
where does the error come from:
Route [verification.verify] not defined
this route/file..
vendor\laravel\framework\src\illuminate\Auth\Middleware\EnsureEmailsVerified.php
function:
public function handle($request, Closure $next, $redirectToRoute = null)
{
if (! $request->user() ||
($request->user() instanceof MustVerifyEmail &&
! $request->user()->hasVerifiedEmail())) {
return $request->expectsJson()
? abort(403, 'Your email address is not verified.')
: Redirect::guest(URL::route($redirectToRoute ?: 'verification.notice'));
}
return $next($request);
}
linea:
: Redirect::guest(URL::route($redirectToRoute ?: 'verification.notice'));
Thank you and success in your projects with laravel. and sorry if I wrote something wrong.