Laravel Reset Password Functionality with Validations




Laravel Reset Password Functionality with Validations

Hi Guys,

In this blog, I will learn you change password functionality with validations in laravel app. We works on Change Password in laravel functionality with validation errors messages. We will reset password with validation using database password using Hash::check method.

So while you are going to change your password then it first validate with database password using Hash::check if match then you update your password with new password.

Here I will give you full example for laravel reset password functionality with validations you can follow bellow step by step.

Step 1 : Install Laravel Application

In this step, You have need to get laravel frash application using bellow command. So lets open terminal and run the bellow command:

composer create-project --prefer-dist laravel/laravel blog

Step 2 : Add Route

In this step, You need to add two route for view and another for post route. So open your "routes/web.php" file and add following route.



Step 3 : Create New Controller

In this step, You can create new controller as ResetPasswordController. In this file we will create two method create() and store(). we will also use validation here. so let's do.



namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\User;

class ResetPasswordController extends Controller


public function create()


return view('resetPassword');


public function store(Request $request)



'current_password' => 'required',

'new_password' => 'required|string|min:6|same:confirm_password',

'confirm_password' => 'required',


$user = \Auth::user();

if (!\Hash::check($request->current_password, $user->password)) {

return back()->with('error', 'Current password does not match!');


$user->password = \Hash::make($request->new_password);


return back()->with('success', 'Password successfully changed!');



Step 4 : Create View File

In this step, You can create resetPassword blade file and we will write code for form create and display error message.So lets create file and put the code


<!DOCTYPE html>



<title>Laravel Reset Password Functionality with Validations -</title>

<link rel="stylesheet" href="" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />

<link rel="stylesheet" type="text/css" href=""></link>

<link rel="stylesheet" type="text/css" href=""></link>

<link rel="stylesheet" type="text/css" href=""></link>


<body class="wysihtml5-supported">

<div class="container">

<div class="row" style="margin-top: 50px;">

<div class="col-md-8 col-md-offset-2">

<div class="panel panel-default">

<div class="panel-heading">

<h3 style="color: black;"> Laravel Reset Password Functionality with Validations -</h3>


<div class="panel-body">

@if (count($errors) > 0)

<div class="row">

<div class="col-md-12">

<div class="alert alert-danger alert-dismissible">

<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>

<h4><i class="icon fa fa-ban"></i> Error!</h4>

@foreach($errors->all() as $error)

{{ $error }} <br>






<form class="image-upload" method="post" action="{{ route('') }}" enctype="multipart/form-data">


<div class="form-group">

<label>Current Password</label>

<input type="password" name="current_password" class="form-control"/>


<div class="form-group">

<label>New Password</label>

<input type="password" name="new_password" class="form-control"/>


<div class="form-group">

<label>Confirm Password</label>

<input type="password" name="confirm_password" class="form-control"/>


<div class="form-group text-center">

<button type="submit" class="btn btn-success btn-sm">Save</button>










Now we are ready to run our example so run bellow command for quick run:

php artisan serve

Now you can open bellow URL on your browser:


It will help you...

#Laravel 7


#Laravel 6