How to create simple password reset or remainders using laravel

Laravel Password Reset / Remainder

Use the php artisan auth:reminders-controller commant.

This creates a file in your app/controllers directory which contains handlers for the following routes:

  • GET /password/remind – Display the password reminder view
  • POST /password/remind – Handles a POST request to remind user of password.
  • GET /password/reset/{token} – Display the password reset view for a token
  • POST /password/reset – Handles the request to reset user’s password

Here’s the file controllers/RemindersController.php which was created using this method.

You can see the email files in view/emails/auth/reminder.blade.php

You only need to add one line to your app/routes.php file to set up routing for this controller.


Changing to a RESTful implementation

One suggestion is to change from using a Controller routing, to a more RESTful way of handling things. To do this:

  • Change the getRemind() method to index().
  • Change the postRemind() method to store().
  • Change the getReset() method to show().
  • Change the postReset() method to update().

You’ll also have to update your views accordingly. Then your app/routes.php file should contain.