Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Laravel Email Verification (technically) work? [closed]

I'm using the standard laravel registration system (php artisan make:auth) and i'm currently wondering how the verification of the mail in laravel works. I don't see any token or something else in the database that could be compared to the one from the "registration-complete" mail of laravel (after sign-up). So how does Laravel acutally make sure that the token is correct?

I already looked in the RegistraterController and think it must have to do something with the User::create() method that is called in the create method of the Controller. But, unfortunateley, i even can not find this method...
(My Laravel is running on version 5.8.7)

like image 895
Marvin Avatar asked Oct 16 '25 07:10

Marvin


1 Answers

Laravel uses so-called signed routes for this purpose that hash the URL with a secret key, so there is no need to store tokens. SeeIlluminate\Routing\UrlGenerator::signedRoute

This function is called via Illuminate\Auth\Notifications\VerifyEmail from Illuminate\Auth\MustVerifyEmail trait used in Illuminate\Foundation\Auth\User model.

On user request the hash is then validated by Illuminate\Routing\UrlGenerator::hasValidSignature

like image 62
chyno Avatar answered Oct 17 '25 20:10

chyno



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!