开发者

sfValidator for compare password sha1

开发者 https://www.devze.com 2023-04-01 12:38 出处:网络
I would like make login panel based on Symfony/Doctrine validators. I found somethings: new sfValidatorSchemaCompare(\'password\', sfValidatorSchemaCompare::EQUAL, \'password_again\')

I would like make login panel based on Symfony/Doctrine validators.

I found somethings:

new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again')

This is in UserForm.class.php

Here password_again is value for input password_again. How can i get this value开发者_运维技巧 from database? I have in database password hash with SHA1.


Please take a look on symfony's sfDoctrineGuardPlugin (or sfGuardPlugin if you use Propel ORM), you'll find everything you need.

  • A login form
  • Password validation
  • Groups and privileges
  • ....

http://www.symfony-project.org/plugins/sfDoctrineGuardPlugin


It seems that you're trying to make a login form right ? Do you have two password fields (like 'password' and 'password_again') in this form ?

If not, you shouldn't be using the sfValidatorSchemaCompare.


create two fields password and confirm password

and put this at the end of validations

$this->validatorSchema['confirm_password'] = clone
    $this->validatorSchema['password'];
    $this->widgetSchema->moveField('confirm_password', 'after', 'password');
    $this->mergePostValidator(
        new sfValidatorSchemaCompare(
            'password', sfValidatorSchemaCompare::EQUAL, 'confirm_password',
            array(), array('invalid' => 'Password does not match! Please retype')));
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号