I am attempting to reset a user's password in Laravel, but the Password::reset method is looking for an email column in the password_tokens table, rather than an id column.
$credentials = ['password' => Input::get('password'),
'id' => $currentUser->id,
'token' => Input::get('token'),
'password_confirmation' => Input::get('password_confirmation')];
return Password::reset($credentials, function($user, $password)
{
$user->password = Hash::make($password);
$user->save();
return Redirect::to('public_site.admin')->with('flash', 'Your password has been reset');
});
This gives me the following error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'email' in 'where clause' (SQL: select * from
password_tokens
wheretoken
= cVh08P70IfWrni2PCxP0KXGyihhc3d2u limit 1)
I haven't passed an email in $credentials, and am not sure where I can set this to use a user id instead (id being the primary key of the users table, and user_id being a foreign key in password_tokens).
I can successfully use Auth in other parts of my application, and lookup users using User::find($userId);
as well, so I don't think there is an issue with the way my User model is set up.
Where does Password::reset look to find the conditions for the query? Is it a part of the user model, is it based on the input it receives, or is it in a config file somewhere?