It's very common that we forgot our password happens everytime but how do we fix that, well stay here and I'll show you how you can reset your password with Laravel Breeze.
Table of contents
- Create new Laravel project
- Configure Database credentials
- Install Laravel Breeze
- Configure Gmail
- Configure Gmail credentials in Laravel
- Reset Password
1. Create new Laravel project.
Run this command
composer create-project laravel/laravel reset-password-project
2. Configure Database Credentials
Open .env file and set your credentials
3. Install Laravel Breeze
To install Laravel Breeze execute this command in your terminal
composer require laravel/breeze
After installing the package, run this command
php artisan breeze:install
To finish this part you need to run
npm install && npm run dev
Note: You need to have installed node.js to execute npm install && npm run dev
Finally we need to run our migrations.
php artisan migrate
Now we can see the registration and login page. Let's go to the registration page and create a new user like the image below.
Let's move to the next step.
4. Configure Gmail.
To reset the password we will be using the reset link via email, of course, we need to configure an email provider in this case I'm going to use Gmail.
Let's go to the user icon located on the right-hand side navbar, click there, you should see a menu and click in manage your account
After that, you should see a new screen, in the left-hand side menu click on security like the image below.
Then select 2-Step Verification and you'll see this screen
Click on GET STARTED and you need to login again to confirm your identity then you have to select between a text message or voice call to complete this, when you insert the right code you'll receive a message to confirm the 2-Step Verification was turn on.
Almost done here. Let's go to security menu (again) and click on App passwords (This would again ask you to login and then authenticate using OTP), after that, you select mail and Other (Custom name) in this screen
Then you can create a new password on this screen. Put the name you want and click GENERATE
Cool!!! Everything is ready.
5. Configure Gmail credentials in Laravel
In the .env configure your Gmail credentials like this
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=youraccount@gmail.com
MAIL_PASSWORD=yourapppassword
MAIL_ENCRYPTION=ssl
6. Reset Password
Let's to the login page.
Then click on Forgot your password? and you should see this screen
Put the email you want to change the password, click EMAIL PASSWORD RESET LINK if everything is good you'll see this message
Just verify in your email account if the message was sent, if you can see the email you can access this screen
This is how you can reset your password!!!!.
Happy coding โ. Thanks for reading ๐.