I use sfDoctrineGuardPlugin. In the form of the password change has three fields:
current password, new password, repeat new password.
If the current is correct, and the new and repeat the same, I do
$this->getUser()->getGuardUser()->setPassword($this->form->getValue('password'));
$this->getUser()->getGuardUser()->save();
In all browsers except ie everything is OK, but in ie when save() is - or revalidation form, or redirect to the same route.
As a result, there is a new check of the current password with the old data (and then have a new password), throws out an error of the form. Tell me what to do, I do not understand how the browser can affect server actions.
public function executeChangePassword(sfWebRequest $request) {
$this->forward404Unless($this->getUser()->isAuthenticated());
$this->form = new ChangePasswordForm();
$this->bSuccess = false;
if ($request->isMethod('post')) {
$this->form->bind($request->getParameter($this->form->getName()));
if ($this->form->isValid()) {
$this->oUser = $this->getUser();
$this->oUser->setPassword($this->form->getValue('password'));
$this->bSuccess = true;
}
}
}
class ChangePasswordForm extends BaseForm {
public function configure() {
$this->setWidgets(array(
'current_password' => new sfWidgetFormInputPassword(array(), array('class' => 'b-input-text')),
'password' => new sfWidgetFormInputPassword(array(), array('class' => 'b-input-text')),
'password_again' => new sfWidgetFormInputPassword(array(), array('class' => 'b-input-text')),
));
$this->validatorSchema['current_password'] = new slValidatorUserPassword(
array('required' => true,
'min_length' => 6,
'max_length' => 128
)
);
$this->validatorSchema['password'] = new sfValidatorString(
array(
'required' => true,
'min_length' => 6,
'max_length' => 128
)
);
$this->validatorSchema['password_again'] = new sfValidatorString(
array('required' => true,
'min_length' => 6,
'max_length' => 128
)
);
$this-> mergePostValidator(new sfValidatorSchemaCompare('password', '==', 'password_again', array(), array()));
$this->widgetSchema->setNameFormat('change_password[%s]');
}
}
You could just use the provided sfGuardChangeUserPasswordForm class. It is included in the plugin.
Here's a working controller example: