Fix conflict
This commit is contained in:
@@ -46,18 +46,23 @@ class CustomerLogin extends BaseForm
|
|||||||
new Constraints\Email(),
|
new Constraints\Email(),
|
||||||
new Constraints\Callback(array(
|
new Constraints\Callback(array(
|
||||||
"methods" => array(
|
"methods" => array(
|
||||||
array($this,
|
array($this, "verifyExistingEmail")
|
||||||
"verifyExistingEmail")
|
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
),
|
),
|
||||||
"label" => Translator::getInstance()->trans("Please enter your email address"),
|
"label" => Translator::getInstance()->trans("Please enter your email address"),
|
||||||
"label_attr" => array(
|
"label_attr" => array(
|
||||||
"for" => "email"
|
"for" => "email"
|
||||||
),
|
)
|
||||||
"required" => true
|
|
||||||
))
|
))
|
||||||
->add("account", "choice", array(
|
->add("account", "choice", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new Constraints\Callback(array(
|
||||||
|
"methods" => array(
|
||||||
|
array($this, "verifyAccount")
|
||||||
|
)
|
||||||
|
))
|
||||||
|
),
|
||||||
"choices" => array(
|
"choices" => array(
|
||||||
0 => Translator::getInstance()->trans("No, I am a new customer."),
|
0 => Translator::getInstance()->trans("No, I am a new customer."),
|
||||||
1 => Translator::getInstance()->trans("Yes, I have a password :")
|
1 => Translator::getInstance()->trans("Yes, I have a password :")
|
||||||
@@ -68,14 +73,34 @@ class CustomerLogin extends BaseForm
|
|||||||
"data" => 0
|
"data" => 0
|
||||||
))
|
))
|
||||||
->add("password", "password", array(
|
->add("password", "password", array(
|
||||||
|
/*"constraints" => array(
|
||||||
|
new Constraints\NotBlank()
|
||||||
|
),*/
|
||||||
"label" => Translator::getInstance()->trans("Please enter your password"),
|
"label" => Translator::getInstance()->trans("Please enter your password"),
|
||||||
"label_attr" => array(
|
"label_attr" => array(
|
||||||
"for" => "password"
|
"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.
|
* 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