使用userPassword Symfony2验证oldPassword

EsopMx

我有下一个代码,现在可以正常工作,但是我正在尝试验证oldPassword,但始终出现不匹配的错误消息。

Aspersoft\DirectorioBundle\Entity\User:
properties:
    password:
        - NotBlank: { groups: [change_password] }
        - Length: { min: 3, max: 20, minMessage: "La cotraseña debe de contener minimo {{ limit }} caracteres de longitud.", maxMessage: "La cotraseña debe de contener maximo {{ limit }} caracteres de longitud.", groups: [change_password]}
    oldPassword:
        - Symfony\Component\Security\Core\Validator\Constraints\UserPassword:
            groups: [change_password]

在我的实体课中:

/**
 * User
 *
 * @ORM\Table(name="user", indexes={@ORM\Index(name="user_index_1", columns={"id_municipality"})})
 * @ORM\Entity(repositoryClass="Aspersoft\DirectorioBundle\Entity\UserRepository")
 */
class User implements AdvancedUserInterface, \Serializable {

    public $oldPassword;

// more properties, getters and setters...

有人知道可能是什么问题吗?以及如何创建属性OldPassword或是否将其在实体中序列化,在symfony页面中,关于Constraint UserPassword的信息不多。

EsopMx

我找到了解决方案。我需要从Type创建表单以与验证类一起正常工作。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章