示例#1
0
 public function verifyPasswordField($value, ExecutionContextInterface $context)
 {
     $data = $context->getRoot()->getData();
     if ($data["password"] === '' && $data["password_confirm"] === '') {
         $context->addViolation("password can't be empty");
     }
     if ($data["password"] != $data["password_confirm"]) {
         $context->addViolation("password confirmation is not the same as password field");
     }
     $minLength = ConfigQuery::getMinimuAdminPasswordLength();
     if (strlen($data["password"]) < $minLength) {
         $context->addViolation("password must be composed of at least {$minLength} characters");
     }
 }