lundi 8 avril 2019

Override Laravel Login to use Crypt

I am doing an import from an old database which stored the passwords in plain text. I know, brutal. Although I want to store the passwords so that they can decrypt them after and view them. (Clients request). I am storing the password as

$user->password = Crypt::encryptString($oldUser->Password);

If the user logs in they will need to use this new Crypt to check. I have this but it keeps throwing me errors

Auth/LoginController


public function login(Request $request)
     {
        $user =   User::where('username', $request->username)
                     ->where('password',Crypt::encryptString($request->password))
                     ->first();
        Auth::login($user);
        return redirect('/');
     }




Users Model:
class User extends Authenticatable

The error is: Argument 1 passed to Illuminate\Auth\SessionGuard::login() must implement interface Illuminate\Contracts\Auth\Authenticatable, null given, called in



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire