Remove login information (Password and Confirm password)
Check if email doesn't exist (Exclude current user)
This commit is contained in:
@@ -23,6 +23,8 @@
|
|||||||
namespace Thelia\Form;
|
namespace Thelia\Form;
|
||||||
|
|
||||||
use Symfony\Component\Validator\Constraints;
|
use Symfony\Component\Validator\Constraints;
|
||||||
|
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||||
|
use Thelia\Model\Base\CustomerQuery;
|
||||||
use Thelia\Model\ConfigQuery;
|
use Thelia\Model\ConfigQuery;
|
||||||
use Thelia\Core\Translation\Translator;
|
use Thelia\Core\Translation\Translator;
|
||||||
|
|
||||||
@@ -51,6 +53,9 @@ class CustomerProfilUpdateForm extends CustomerCreateForm
|
|||||||
->remove("city")
|
->remove("city")
|
||||||
->remove("zipcode")
|
->remove("zipcode")
|
||||||
->remove("country")
|
->remove("country")
|
||||||
|
// Remove Login Information
|
||||||
|
->remove("password")
|
||||||
|
->remove("password_confirm")
|
||||||
// Remove Terms & conditions
|
// Remove Terms & conditions
|
||||||
->remove("agreed")
|
->remove("agreed")
|
||||||
|
|
||||||
@@ -64,6 +69,20 @@ class CustomerProfilUpdateForm extends CustomerCreateForm
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $value
|
||||||
|
* @param ExecutionContextInterface $context
|
||||||
|
*/
|
||||||
|
public function verifyExistingEmail($value, ExecutionContextInterface $context)
|
||||||
|
{
|
||||||
|
$customer = CustomerQuery::create()->findOneByEmail($value);
|
||||||
|
// If there is already a customer for this email address and if the customer is different from the current user, do a violation
|
||||||
|
if ($customer && $customer->getId() != $this->getRequest()->getSession()->getCustomerUser()->getId()) {
|
||||||
|
$context->addViolation("This email already exists.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return "thelia_customer_profil_update";
|
return "thelia_customer_profil_update";
|
||||||
|
|||||||
Reference in New Issue
Block a user