appoly / api-password-helper
Allow the users to request a forgotten password and reset over api requests
Installs: 4 495
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 4
Forks: 3
Open Issues: 1
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-11-22 01:57:11 UTC
README
Introduction
Save time creating functions to manage forgotten passwords in laravel for your Api's. This package will add a new key to your users model, along with two new routes that will handle the forgotten and reset password.
Quick Usage
Composer
composer require appoly/api-password-helper
Usage
Add the new key to your users table.
php artisan migrate
The Users Model needs to be Notifiable as an email will be automatically sent to them
class User extends Authenticatable
{
use Notifiable;
Routes
Two new routes will be created in your application
GET: /api/forgot-password?email=johndoe@example.com
The Post route takes two form data parameters in the request key and password.
POST: /api/forgot-password
If your user model has $fillable
ensure that password_helper_key
is added to the list of fields that are allowed to be updated.
Edit the email
To edit the email you need to publish the config to your project using
php artisan vendor:publish --tag=api-password-helper-config --force
This will add the LaravelApiPasswordHelper file to your config folder, from there you can edit different sections of the email
SmartSchema Compatibility
If you are using SmartSchema to manage your models fillables then add SmartField to your model
class User extends Authenticatable
{
use Notifiable, SmartField;