php - 覆盖 Laravel 登录以使用 Crypt
问题描述
我正在从以纯文本形式存储密码的旧数据库进行导入。我知道,残酷。虽然我想存储密码,以便他们可以在之后解密并查看它们。(客户要求)。我将密码存储为
$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,调用
解决方案
推荐阅读
- r - R:如何将日期间隔扩展到单个日期
- c# - MailKit:搜索查询以从服务器获取一定范围的 Uid
- python - “NoneType”对象没有属性“值”
- javascript - 在单击测试用例上反应本机检查上下文值
- django - Django 测试和 Trigram 相似性问题
- android - 如何修复此 PlayerNotificationManager.createWithNotificationChannel 错误
- similarity - 我在哪里可以找到 Scilab balanc() 函数来计算相似度变换以在 Maxima 中对其进行编程
- swift - 如何确定 UIBezierPath 相对于其父视图的 arcCenter?
- android - 无法预览您可能离线或连接受限的文件。尝试在andorid中下载
- python - Python aiohttp 解析