password
值是
1 digit
但当我试图更新密码时,它不会被更新,当我输入
6 digits
在密码中,它工作正常。
我发现在
vendor\laravel\framework\src\Illuminate\Auth\Passwords
一
passwordBroker.php
文件有一个函数
protected function validatePasswordWithDefaults(array $credentials)
{
list($password, $confirm) = [
$credentials['password'],
$credentials['password_confirmation'],
];
return $password === $confirm && mb_strlen($password) >= 6; // here it is
}
它包含验证
($password) >= 6
我如何删除它,当我在这个文件中更改它是工作的。在我身上
.gitignore
vendor
未在Live中更新文件夹。解决方案是什么?如何覆盖此验证?
这里是我的
resetpassword
功能
public function resetPassword(ResetPasswordRequest $request, JWTAuth $JWTAuth)
{
$validator = Validator::make($request->all(), User::resetPasswordRules());
if ($validator->fails()) {
return response()->json([
'message' => "422 Unprocessable Entity",
'errors' => $validator->messages(),
'status_code' => 422,
]);
}
$response = $this->broker()->reset(
$this->credentials($request), function ($user, $password) {
$this->reset($user, $password);
}
);
if($response !== Password::PASSWORD_RESET) {
return response()->json([
'message' => "Internal Server Error",
'status_code' => 500,
]);
}
$user = User::where('email', '=', $request->get('email'))->first();
$user->UserDeviceData()->firstOrCreate([
'device_id' => $request->device_id
]);
return (new UserTransformer)->transform($user,[
'request_type' => 'reset_password',
'token' => $JWTAuth->fromUser($user)
]);
}