Home > Software engineering >  Laravel Auth::attempt and Hashing password
Laravel Auth::attempt and Hashing password

Time:10-11

Due to limitation of internet connection in my area, I decided to not using the laravel/ui package.

My problem is that the Auth::attempt is not working properly. The hash keeps changing so the hashed password do not match. Help.

if (Auth::attempt(['email'=> $request->input('email'), 'password'=> $request->input('password')])

CodePudding user response:

use Hash; Hash::make($request->input('input'));

CodePudding user response:

First of all query to get user

$user  = User::where('email' , $request->input('email') ) ->first();

Then check hashed password with input password

$password  = $request->input('password');
if (!Hash::check($password, $user->password)) { 
    //login failed 
    // return proper message to user 
    // return back();
}
Auth::login($user);
  • Related