Reputation: 12194
I'm migrating a Drupal6 project in Laravel, so i need to use the "old" Drupal6 users table with passwords in MD5. Is there a way to modify the call to Auth passing the password in md5, without modifying the core Laravel files?
I do:
$userdata = array(
'mail' => Input::get('email'),
'password' => Input::get('password')
);
if (Auth::attempt($userdata)) {
//OK
}
else {
//KO
}
How can i handle custom user auth in Laravel?
Upvotes: 0
Views: 873
Reputation: 87719
No, but you can do the auth yourself easily:
$user = User::where('email', Input::get('email'))->first();
if( $user && $user->password == md5(Input::get('password')) )
{
Auth::login($user); /// will log the user in for you
return Redirect::intended('dashboard');
}
else
{
/// User not found or wrong password
}
Upvotes: 3