Reputation: 58662
I'm stuck trying to authenticate my user to log-in in Laravel 5.
$user = User::where('code','=', Input::get('code'))->first();
$password = Input::get('password');
$user->password = Hash::make($password);
$user->code = $code;
$user->username = Input::get('username');
$user->active = 1;
$user->save();
$auth = Auth::attempt(['username' => $user->username, 'password' => $user->password, 'active' => 1]);
when I do dd($auth);
, It print out false
.
It wired because I check my database, that user is there with :
What did I do wrong here ? Is it sth that they change in Laravel 5 ?
Upvotes: 1
Views: 107
Reputation: 33068
You don't hash the password before you send it to the attempt()
function. It will hash it again and compare it against the single hashed version.
Try this...
$auth = Auth::attempt(['username' => $user->username, 'password' => Input::get('password'), 'active' => 1]);
Upvotes: 2