Step 1: Set Up Email Configuration
Laravel needs a mail driver configured to send emails.
-
Open
.envfile and configure your mail settings. For example, using Gmail SMTP:
- Note: For Gmail, you need to generate an App Password if 2FA is enabled.
-
Clear config cache:
Step 2: Use Laravel’s Built-in Auth Scaffolding
Laravel comes with a built-in system for password reset. If you don’t already have authentication scaffolding, you can install Laravel Breeze (or Jetstream/Ui):
This will generate login, register, forgot password, and reset password views and routes.
Step 3: Routes
Laravel automatically registers the routes for password reset when you use Breeze/Jetstream. You can check routes using:
Key routes:
| Method | URI | Action |
|---|---|---|
| GET | /forgot-password |
showForgotPasswordForm |
| POST | /forgot-password |
sendResetLinkEmail |
| GET | /reset-password/{token} |
showResetPasswordForm |
| POST | /reset-password |
reset |
Step 4: Forgot Password Form
The default form is located in resources/views/auth/forgot-password.blade.php:
