user3825129 user3825129 - 23 days ago 11
PHP Question

How to match input password and database hash password in laravel 4

How to authenticate a user password from a given request in Laravel? How is the password checked against the password hash stored in the database?

Answer

First, you'll need to find the User who is logging in based on email address or username or however you identify them, for example:

$user = User::where('email', '=', 'email@address.com')->first();

Then, you'll need to CHECK the hashed password, like so:

Hash::check('INPUT PASSWORD', $user->password);

This will return true or false based on whether or not the password matches.

Comments