Change Password Functionality with Laravel Authentication
In this article, we will implement the Change password functionality over the basic Authentication that is provided by Laravel.
Before we jump into the implementation make sure you have the following ready.
Note: This tutorial works with Laravel 5.5 as well as the new version of Laravel 8
Alright, let’s dive into the steps.
Change Password Form Page
Let’s first create a change password form page and the required route and controller method for the same.
Add the following entry into your route (routes / web.php) file.
Route Entry
Now let’s add the supporting controller method showChangePasswordForm
in Controller. For demonstration purposes, I am adding my controller method’s in HomeController
. But you are free to put it in any other suitable controller or create a separate controller for the change-password functionality.
Controller Method
Note: Make sure your controller is restricted with auth
middleware. With that, we can make sure that only authenticated users can access the change password functionality. You should have auth middleware in your controller’s constructor.
and now, let’s create our change password view file named changepassword.blade.php
under resources / views / auth .
View File
This is all is required to create your change password form. Now if the user is logged in and if you go to yourdomain.dev/changePassword
then you should see the below page.
0 Comments
CAN FEEDBACK
Emoji