我正在将一个旧的php-html网站迁移到vuejs / laravel。
已经有成千上万的用户,所以我想我不能更改密码加密。目前,仅使用mysql password()方法对其进行加密,然后检查password(password)== password(authpassword)。 但是可以在我的laravel身份验证中添加此password()吗?我已经删除了哈希。
public function login(Request $request){
$user = User::where('email', $request->email)
->where('pwd', $request->password)
->first();
if($user) {
Auth::login($user);
return redirect()->back();
} else {
return redirect()->back()->withInput();
}
}
注册
protected function validator(array $data)
{
return Validator::make($data, [
'nom' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255'],
'pwd' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
protected function create(array $data)
{
return User::create([
'email' => $data['email'],
'login' => $data['email'],
'pwd' => ($data['password']),
'type' => 'P'
]);
}
public function register(Request $request)
{
event(new Registered($user = $this->create($request->all())));
$this->guard()->login($user);
}
非常感谢!