Download the PHP package dcvn/otp-laravel without Composer
On this page you can find all versions of the php package dcvn/otp-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dcvn/otp-laravel
More information about dcvn/otp-laravel
Files in dcvn/otp-laravel
Package otp-laravel
Short Description Laravel layer for local OTP authentication
License MIT
Informations about the package otp-laravel
OneTimePassword (OTP) for Laravel
A Laravel layer for local OTP authentication.
This is an attempt to make OTP implementation in Laravel easy.
Being a layer, this could not exist without these core dependencies:
- the package robthree/twofactorauth does the real OTP logic, and
- the included merged version of phpqrcode does the real QRCode generation.
Being local, otp-laravel does, by default, not depend on network services to generate QR codes (with thanks to the offline example of RobThree using phpqrcode).
Quickstart setup
Follow the Quickstart to setup a new Laravel project using this OTP package.
The most important part is, in the LoginController,
to replace the existing use AuthenticatesUsers
to use Dcvn\Otp\Http\Controllers\AuthenticatesUsers;
.
If you feel real lazy, copy this quickstart.sh script to the base dir of your projects, and run it (at your own risk).
Features
Assuming using the quickstart way, but you can implement how you like it.
- Adds an
otp_secret
column to theusers
table (migration). - Adds an OTP input to the login page, and validates for it when it has been set up.
- Adds routes, controller methods and views for setting up OTP for a user.
- By default, you are only allowed to do the setup for your own user.
- Many settings are configurable by config and
.env
. - Translations available in english and dutch.
OneTimePassword
as alias in the app.
OneTimePassword example
Publish files
You don't necessarily need this, but you can copy config, language or view files to your project this way:
To override the access policy
(for example to allow (only) admin users to do the setup),
copy this to your AuthServiceProvider
's boot()
method,
then modify it: