- Forums
- laravel
- Step 1B - Laravel Add Email Verification To Register Create Account Login Profile
Follow these instructions and commands to add email verification when user register. [5242], Last Updated: Mon Jun 24, 2024
edw
Mon Dec 11, 2023
0 Comments
285 Visits
To add email verification follow these steps.
TERMINAL COMMANDS:
$ composer require laravel/jetstream
$ php artisan jetstream:install livewire
$ npm run build
$ php artisan migrate
$ code app/Models/User.php
- uncomment // use Illuminate\Contracts\Auth\MustVerifyEmail;
- change to: class User extends Authenticatable implements MustVerifyEmail
$ code config/fortify.php
- uncomment // Features::emailVerification()
SETUP GMAIL SMTP SERVER:
- Go to this url and start on step 7 https://myaccount.google.com/apppasswords, otherwise, start from step 2 below.
- Go to https://mail.google.com/mail/u/0/#inbox
- Manage Google Account:
- Security: https://myaccount.google.com/
- 2 step authentication: https://myaccount.google.com/signinoptions/two-step-verification
- scroll to App passwords : https://myaccount.google.com/apppasswords
- To create a new app specific password, type a name for it below...
- App Name: YourAppName
- Generated app password
- copy pasword:
- Click done
Settings:
$ code .env
- MAIL_MAILER=smtp
- MAIL_HOST=smtp.gmail.com
- MAIL_PORT=465
- [email protected]
- MAIL_PASSWORD=[GMAIL APP PASSWORD]
- MAIL_ENCRYPTION=ssl
- MAIL_FROM_ADDRESS="[email protected]"
- MAIL_FROM_NAME="${APP_NAME}"
$ php artisan config:cache
http://127.0.0.1:8000/register
Resources:
- https://jetstream.laravel.com/installation.html
- Video: vrkg5F_DUCg