Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions reference/constraints/UserPassword.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ but needs to enter his old password for security.
When applied to an array (or Traversable object), this constraint allows
you to apply a collection of constraints to each element of the array.

+----------------+----------------------------------------------------------------------------------------+
| Applies to | :ref:`property or method<validation-property-target>` |
+----------------+----------------------------------------------------------------------------------------+
| Options | - `message`_ |
+----------------+----------------------------------------------------------------------------------------+
| Class | :class:`Symfony\\Bridge\\Security\\Core\\Validator\\Constraints\\UserPassword` |
+----------------+----------------------------------------------------------------------------------------+
| Validator | :class:`Symfony\\Bridge\\Security\\Core\\Validator\\Constraint\\UserPasswordValidator` |
+----------------+----------------------------------------------------------------------------------------+
+----------------+-------------------------------------------------------------------------------------------+
| Applies to | :ref:`property or method<validation-property-target>` |
+----------------+-------------------------------------------------------------------------------------------+
| Options | - `message`_ |
+----------------+-------------------------------------------------------------------------------------------+
| Class | :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraint\\UserPassword` |
+----------------+-------------------------------------------------------------------------------------------+
| Validator | :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraint\\UserPasswordValidator` |
+----------------+-------------------------------------------------------------------------------------------+

Basic Usage
-----------
Expand All @@ -42,20 +42,20 @@ password:
Acme\UserBundle\Form\Model\ChangePassword:
properties:
oldPassword:
- UserPassword:
- Symfony\Component\Security\Core\Validator\Constraint\UserPassword:
message: "Wrong value for your current password"

.. code-block:: php-annotations

// src/Acme/UserBundle/Form/Model/ChangePassword.php
namespace Acme\UserBundle\Form\Model;

use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Security\Core\Validator\Constraints as SecurityAssert;

class ChangePassword
{
/**
* @Assert\UserPassword(
* @SecurityAssert\UserPassword(
* message = "Wrong value for your current password"
* )
*/
Expand Down