maddog670
@maddog670

Длина пароля при восстановлении пароля в Laravel?

Вечер добрый.
Стоит laravel 5.8, что-то не пойму, почему в правиле валидации не учитывается длина пароля?
Пропускает только от 8 и выше, до этого выскакивает ошибка, что мол нужно от 8 и всё, хотя указано 4 вообще.
Или может я не в том месте смотрю ?
Трейт ResetsPassword
/**
     * Get the password reset validation rules.
     *
     * @return array
     */
    protected function rules()
    {
        return [
            'token'    => 'required',
            'email'    => 'email',
            'password' => 'required|confirmed|min:4',
        ];
    }
  • Вопрос задан
  • 210 просмотров
Решения вопроса 1
maddog670
@maddog670 Автор вопроса
В трейте ResetsPasswords заменить метод на мой и будет работать. До 5.8 laravel включительно
public function reset(Request $request)
    {
        $request->validate([
            'token' => 'required',
            'email' => 'required|email',
            'password' => 'required|confirmed|min:6',
        ], $this->validationErrorMessages());

        // Here we will attempt to reset the user's password. If it is successful we
        // will update the password on an actual user model and persist it to the
        // database. Otherwise we will parse the error and return the response.
        $this->broker()->validator(function ($credentials) {
            return mb_strlen($credentials['password']) >= 6;
        });

        $response = $this->broker()->reset(
            $this->credentials($request),
            function ($user, $password) {
                $this->resetPassword($user, $password);
            }
        );

        // If the password was successfully reset, we will redirect the user back to
        // the application's home authenticated view. If there is an error we can
        // redirect them back to where they came from with their error message.
        return $response == Password::PASSWORD_RESET
            ? $this->sendResetResponse($request, $response)
            : $this->sendResetFailedResponse($request, $response);
    }
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
@vism
ох блин, он зашил где-то в ядре...
Помоему в 6.0 его оттуда вынесли и позволили менять :(
Где именно уже не помню, но проблема популярна.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
19 апр. 2024, в 03:52
1000 руб./за проект
19 апр. 2024, в 03:01
1000 руб./за проект
18 апр. 2024, в 21:56
2000 руб./за проект