Laravel 2 Step Authentication Package
, (*1)
Laravel 2-Step Verification is a package to add 2-Step user authentication to any Laravel project easily. It is configurable and customizable. It uses notifications to send the user an email with a 4-digit verification code. Can be used in out the box with Laravel's authentication scaffolding or integrated into other projects., (*2)
Table of contents: - Features - Requirements - Installation Instructions - Configuration - Environment File - Usage - Routes - Screenshots - File Tree - Future - Opening an Issue - License, (*4)
Laravel 2 Step Verification Features |
---|
Uses Notification Class to send user code to users email |
Can publish customizable views and assets |
Lots of configuration options |
Uses Language localization files |
Verificaton Page |
Locked Page |
From your projects root folder in terminal run:, (*5)
Laravel 6+ use:, (*6)
composer require jeremykenedy/laravel2step
Laravel 5.8 use:, (*7)
composer require jeremykenedy/laravel2step:v1.4.0
Laravel 5.7 and below use:, (*8)
composer require jeremykenedy/laravel2step:v1.0.2
Register the package, (*9)
Laravel 5.5 and up
Uses package auto discovery feature, no need to edit the config/app.php
file., (*10)
Laravel 5.4 and below
Register the package with laravel in config/app.php
under providers
with the following:, (*11)
'providers' => [ jeremykenedy\laravel2step\laravel2stepServiceProvider::class, ];
php artisan vendor:publish --tag=laravel2step
Optionally Update your .env
file and associated settings (see Environment File section), (*12)
Run the migration to add the verifications codes table:, (*13)
php artisan migrate
.env
file with the needed configuration variables..env
file.Laravel 2-Step Verification can be configured in directly in /config/laravel2step.php
or in the variables in your .env
file., (*14)
Here are the .env
file variables available:, (*15)
LARAVEL_2STEP_ENABLED=true LARAVEL_2STEP_DATABASE_CONNECTION=mysql LARAVEL_2STEP_DATABASE_TABLE=laravel2step LARAVEL_2STEP_USER_MODEL=App\User LARAVEL_2STEP_EMAIL_FROM="anEmailIsrequired@email.com" LARAVEL_2STEP_EMAIL_FROM_NAME="Laravel 2 Step Verification" LARAVEL_2STEP_EMAIL_SUBJECT='Laravel 2 Step Verification' LARAVEL_2STEP_EXCEEDED_COUNT=3 LARAVEL_2STEP_EXCEEDED_COUNTDOWN_MINUTES=1440 LARAVEL_2STEP_VERIFIED_LIFETIME_MINUTES=360 LARAVEL_2STEP_RESET_BUFFER_IN_SECONDS=300 LARAVEL_2STEP_CSS_FILE="css/laravel2step/app.css" LARAVEL_2STEP_APP_CSS_ENABLED=false LARAVEL_2STEP_APP_CSS="css/app.css" LARAVEL_2STEP_BOOTSTRAP_CSS_CDN_ENABLED=true LARAVEL_2STEP_BOOTSTRAP_CSS_CDN="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
Laravel 2-Step Verification is enabled via middleware. You can enable 2-Step Verification in your routes and controllers via the following middleware:, (*16)
twostep
Example to start recording page views using middlware in web.php
:, (*17)
Route::group(['middleware' => ['twostep']], function () { Route::get('/home', 'HomeController@index')->name('home'); });
/verification/needed
/verification/verify
/verification/resend
, (*18)
βββ laravel2step βββ .gitignore βββ LICENSE βββ README.md βββ composer.json βββ src βββ .env.example βββ Laravel2stepServiceProvider.php βββ app βΒ Β βββ Http βΒ Β βΒ Β βββ Controllers βΒ Β βΒ Β βΒ Β βββ TwoStepController.php βΒ Β βΒ Β βββ Middleware βΒ Β βΒ Β βββ Laravel2step.php βΒ Β βββ Models βΒ Β βΒ Β βββ TwoStepAuth.php βΒ Β βββ Notifications βΒ Β βΒ Β βββ SendVerificationCodeEmail.php βΒ Β βββ Traits βΒ Β βββ Laravel2StepTrait.php βββ config βΒ Β βββ laravel2step.php βββ database βΒ Β βββ migrations βΒ Β βββ 2017_12_09_070937_create_two_step_auth_table.php βββ public βΒ Β βββ css βΒ Β βββ app.css βΒ Β βββ app.min.css βββ resources βΒ Β βββ assets βΒ Β βΒ Β βββ scss βΒ Β βΒ Β βββ _animations.scss βΒ Β βΒ Β βββ _mixins.scss βΒ Β βΒ Β βββ _modals.scss βΒ Β βΒ Β βββ _variables.scss βΒ Β βΒ Β βββ _verification.scss βΒ Β βΒ Β βββ app.scss βΒ Β βββ lang βΒ Β βΒ Β βββ en βΒ Β βΒ Β βββ laravel-verification.php βΒ Β βββ views βΒ Β βββ layouts βΒ Β βΒ Β βββ app.blade.php βΒ Β βββ partials βΒ Β βββ scripts βΒ Β βΒ Β βββ input-parsing-auto-stepper.blade.php βΒ Β βββ twostep βΒ Β βββ exceeded.blade.php βΒ Β βββ verification.blade.php βββ routes βββ web.php
brew install tree
tree -a -I '.git|node_modules|vendor|storage|tests
Before opening an issue there are a couple of considerations: * You are all awesome! * Read the instructions and make sure all steps were followed correctly. * Check that the issue is not specific to your development environment setup. * Provide duplication steps. * Attempt to look into the issue, and if you have a solution, make a pull request. * Show that you have made an attempt to look into the issue. * Check to see if the issue you are reporting is a duplicate of a previous reported issue. * Following these instructions show me that you have tried. * If you have a questions send me an email to jeremykenedy@gmail.com * Need some help, I can do my best on Slack: https://opensourcehelpgroup.slack.com * Please be considerate that this is an open source project that I provide to the community for FREE when openeing an issue., (*19)
Open source projects are a the communityβs responsibility to use, contribute, and debug., (*20)
Laravel 2-Step Verification is licensed under the MIT license. Enjoy!, (*21)