Get the current password and compare it with the new password.
//use Auth, Hash, Input; if (Hash::check(Input::get('new_password'), Auth::user()->password)) echo "Matched"; else echo "Not matched";
Have you used laravel built into the authentication package? If so, a check has been made for you. Check the application /Http/Controller/Auth/AuthController.php, you can see this check function. You can add more if you want:
protected function validator(array $data) { return Validator::make($data, [ 'first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|confirmed|min:6', ]); }
If any error occurred during the above check, it will be sent to the $ errors variable, where your blade can catch them. So, in your reset password view (view / auth / reset.blade.php), you can catch validation errors like this:
@if (count($errors) > 0) <div class="alert alert-danger"> <strong>Whoops!</strong> There were some problems with your input.<br><br> <ul> @foreach ($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> </div> @endif
source share