Fix conflict
This commit is contained in:
@@ -46,18 +46,23 @@ class CustomerLogin extends BaseForm
|
||||
new Constraints\Email(),
|
||||
new Constraints\Callback(array(
|
||||
"methods" => array(
|
||||
array($this,
|
||||
"verifyExistingEmail")
|
||||
array($this, "verifyExistingEmail")
|
||||
)
|
||||
))
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Please enter your email address"),
|
||||
"label_attr" => array(
|
||||
"for" => "email"
|
||||
),
|
||||
"required" => true
|
||||
)
|
||||
))
|
||||
->add("account", "choice", array(
|
||||
"constraints" => array(
|
||||
new Constraints\Callback(array(
|
||||
"methods" => array(
|
||||
array($this, "verifyAccount")
|
||||
)
|
||||
))
|
||||
),
|
||||
"choices" => array(
|
||||
0 => Translator::getInstance()->trans("No, I am a new customer."),
|
||||
1 => Translator::getInstance()->trans("Yes, I have a password :")
|
||||
@@ -68,14 +73,34 @@ class CustomerLogin extends BaseForm
|
||||
"data" => 0
|
||||
))
|
||||
->add("password", "password", array(
|
||||
/*"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),*/
|
||||
"label" => Translator::getInstance()->trans("Please enter your password"),
|
||||
"label_attr" => array(
|
||||
"for" => "password"
|
||||
),
|
||||
'required' => false
|
||||
"required" => false
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* If the user select "Yes, I have a password", we check the password.
|
||||
*/
|
||||
public function verifyAccount($value, ExecutionContextInterface $context)
|
||||
{
|
||||
if ($value == 1) {
|
||||
$data = $context->getRoot()->getData();
|
||||
|
||||
//$context->validate('password', array(new Constraints\NotBlank()) );
|
||||
|
||||
if (false === $data['password'] || (empty($data['password']) && '0' != $data['password'])) {
|
||||
$context->addViolationAt("password", "This value should not sssbe blank");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If the user select "I'am a new customer", we make sure is email address does not exit in the database.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user