current method works of course - but is it the best method ?
On 11 Kwi, 18:00, dziobacz <[email protected]> wrote: > When user want to change password he sees form to change password: > $this->widgetSchema['password'] = new sfWidgetFormInputPassword(); > $this->widgetSchema['password_confirmation'] = new > sfWidgetFormInputPassword(); > > (I know it should be also old_password field but it isn't important > now). I have login this user from actions.class.php file in form file > in variable $login. > > I have tried: > $this->validatorSchema->setPostValidator(new sfValidatorAnd(array( > > new sfValidatorSchemaCompare('password', > sfValidatorSchemaCompare::EQUAL, > 'password_confirmation', array(), array('invalid' => 'Passwords must > be the same.')), > > new sfValidatorSchemaCompare('password', > sfValidatorSchemaCompare::NOT_EQUAL, > $login, array(), array('invalid' => 'LOGIN AND PASSWORD CAN'T BE THE > SAME.')), > > ))); > > I have also tried in above sfValidatorSchemaCompare written: "$login", > '$login' also 'Michael' (it is a login) - and it doesn't work, I can > always change password for the same like login. > > Now I have that (username in hidden field): > > $this->widgetSchema['username'] = new sfWidgetFormInputHidden(); > $this->setDefault('username', $login); > > new sfValidatorSchemaCompare('password', > sfValidatorSchemaCompare::NOT_EQUAL, > 'username', array(), array('invalid' => 'LOGIN AND PASSWORD CAN'T BE > THE SAME.')) > > $this->validatorSchema->setOption('allow_extra_fields', true); > $this->validatorSchema->setOption('filter_extra_fields', false); > > Is it the best method ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
