How to check current password using hash check in Laravel 5.3?By Hardik Savani | September 18, 2016 | | 8243 Viewer | Category : Laravel
Share this post:
Sometimes we are working on change password function at that time we require to check with current password. If current password should be match otherwise return error with "your old password is wrong".
I mean we have one form with three input field like as bellow:
3)confirm new password
When it will submit form we have to check current password match with store database table password. So, laravel store hash password, that way we can't check directly equal to condition, But Laravel provide Hash facade, Hash::check() method will help you to do this task.
You can see bellow simple example method:
public function changePassword(Request $request)
$input = $request->all();
$user = User::find(auth()->user()->id);
dd('Return error with current passowrd is not match.');
dd('Write here your update password code');
It can help you...
- How to create authentication(login and registration) in Laravel 5.2?
- Laravel 5.2 multi auth example using Auth guard from scratch
- Laravel 5 Google OAuth authentication using Socialite Package
- Laravel 5 Facebook authentication using Socialite Package
- Laravel 5.2 API using JWT authentication tutorial from scratch example
- Laravel 5 - whereIn and whereNotIn with subquery example using query builder
- How to count number of files in folder and remove all files in folder example in Laravel 5 ?
- How to remove comma from string in jquery with example ?
- How to check column exists or not in table Laravel 5
- How to set vertical align middle div by CSS in HTML?
- Jquery - draggable sortable table rows example demo with bootstrap
- Laravel - How to get current URL in controller or view?
- How to set bootstrap timepicker using datetimepicker library example code