首页 > 解决方案 > Symfony PHP 文档“如何创建自定义表单密码验证器”中的错误

问题描述

我在文档中发现了 2 个问题。你能告诉我这对你来说是否也有问题吗?在页面https://symfony.com/doc/3.4/security/custom_password_authenticator.html 第 43 行:

if (!$this->encoder->isPasswordValid($user->getPassword(), $givenPassword, $user->getSalt())) {
    throw new BadCredentialsException('The given password is invalid.');
}

代替:

if (!$this->encoder->isPasswordValid($user, $givenPassword, $user->getSalt())) {
    throw new BadCredentialsException('The given password is invalid.');
}

第 48 行

if ($isPasswordValid) {
     *$isPasswordValid* is empty
}

标签: phpsymfony

解决方案


推荐阅读