Add validation for the current password

This commit is contained in:
touffies
2013-10-24 00:17:59 +02:00
parent 04c43a12da
commit 3e3695e5d3

View File

@@ -26,6 +26,7 @@ use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Translation\Translator;
use Thelia\Model\CustomerQuery;
/**
* Class CustomerPasswordUpdateForm
@@ -79,7 +80,10 @@ class CustomerPasswordUpdateForm extends BaseForm
public function verifyCurrentPasswordField($value, ExecutionContextInterface $context)
{
// Check current password
// Check if value of the old password match the password of the current user
if (!password_verify($value, $this->getRequest()->getSession()->getCustomerUser()->getPassword())) {
$context->addViolation("Your current password does not match.");
}
}
public function verifyPasswordField($value, ExecutionContextInterface $context)