我正在从旧数据库中导入,该数据库以纯文本格式存储密码。我知道,很残酷。尽管我想存储密码,以便密码可以在以后解密并查看。 (客户要求)。我将密码存储为
$user->password = Crypt::encryptString($oldUser->Password);
如果用户登录,则需要使用这个新的Crypt进行检查。我有这个,但总是让我出错
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
错误是:
传递给Illuminate \ Auth \ SessionGuard :: login()的参数1必须实现Illuminate \ Contracts \ Auth \ Authenticatable接口,给定null,在
中调用