Php 应该使用哪个验证器在Symfony中实现登录?

Php 应该使用哪个验证器在Symfony中实现登录?,php,symfony1,validation,Php,Symfony1,Validation,目前,我的登录表单如下所示 class LoginForm extends BaseFormPropel { public function setup() { $this->setWidgets(array( 'login_id' => new sfWidgetFormInput(), 'pwd' => new sfWidgetFormInputPassword() )); $this->widgetSche

目前,我的登录表单如下所示

class LoginForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'login_id' => new sfWidgetFormInput(), 
      'pwd' => new sfWidgetFormInputPassword() 
    ));

    $this->widgetSchema->setLabels(array(
        'login_id'=>'Login Id',
        'pwd'=>'Password'
    ));

    $this->widgetSchema->setNameFormat('member[%s]');

    $this->setValidators(array(
      'login_id' => new sfValidatorPropelChoice(array('model' => 'Member', 'column' => 'login_id', 'required' => true)), 
      'pwd' => new sfValidatorPropelChoice(array('model' => 'Member', 'column' => 'pwd', 'required' => true))
    ));

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }


  public function getModelName()
  {
    return 'Member';
  }

}
但这是一个错误的实现,因为SFValidatorPropertyChoice只确保用户输入列中确实存在的值。这意味着如果数据库包含以下行

登录id| pwd
约翰,12345
彼得,67890

使用john和67890登录的用户将成功。
我的问题是,我应该使用哪个验证器来更正问题?

您应该使用自己的验证器,因为您正在尝试同时验证两个表单字段。或者您可以使用并忘记这个问题。

您应该使用自己的后验证器,因为您试图同时验证两个表单字段。或者你可以使用并忘记这个问题。

做这项工作没有好办法。在sfGuard中,表单验证传入数据,并在使用表单数据登录用户后,以下是示例

如果($this->form->isValid()){
$values=$this->form->getValues();
$this->getUser()->sign($values['user']); }

我不知道是否有可能sfvalidator和做类似的事情,但是登录过程在web应用程序中非常重要,所以,您应该处理这个过程中的代码


做这项工作没有好办法。在sfGuard中,表单验证传入数据,并在使用表单数据登录用户后,以下是示例

如果($this->form->isValid()){
$values=$this->form->getValues();
$this->getUser()->sign($values['user']); }

我不知道是否有可能sfvalidator和做类似的事情,但是登录过程在web应用程序中非常重要,所以,您应该处理这个过程中的代码


非常感谢您的回复。两种解决方案都应该有效,很难说哪一种更好。请允许我选择sfGuard使用的方法。非常感谢您的回复。两种解决方案都应该有效,很难说哪一种更好。我可以选择sfGuard使用的方法吗。