A Laravel Package to Protect Routes With a PIN Code
Published on by Paul Redmond
Require Pin is a Laravel package for pin confirmation and validation before processing requests to a specified route. This package provides a middleware that requires users to enter a valid PIN code before proceeding to a PIN-protected route:
When a user tries to visit
/see-my-paycheck in the above example, this package will prompt the user to enter their PIN code before taking them to the page. This package also provides an API route you can use to validate and manage a user's PIN.
The basic idea of how this package works within your Laravel app is as follows:
- Add the
require.pinmiddleware to routes or a group of routes requiring a pin
- The middleware will intercept those routes
- The package generates a temporary URL to authenticate with their PIN
- Once the user enters their valid PIN, it will redirect and allow them access to the PIN-protected route
You can learn more about this package, get full installation instructions, and view the source code on GitHub.