Laravel Two-Factor Auth via Email

Simple demo-project to add two-factor authentication, with sending 6-digit unique verification code via email.

Every time user logs in, they will see this view, with ability to re-send the code:

Laravel two-factor authentication form

At the same time, this email will be sent:

Laravel two-factor authentication email


System is partly generated with QuickAdminPanel, based on Laravel 6 and CoreUI Free theme (Bootstrap 4) with form customization afterwards.


How to use

  • Clone the repository with git clone
  • Copy .env.example file to .env and edit database credentials there, also email provider settings (to send verification codes)
  • Run composer install
  • Run php artisan key:generate
  • Run php artisan migrate --seed (it has some seeded data for your testing)
  • That's it: launch the main URL.
  • You can login to adminpanel with default credentials admin@admin.com - password

License

Basically, feel free to use and re-use any way you want.


More from our LaravelDaily Team