/** * @param UserPasswordForm $form */ public function formSubmitted(UserPasswordForm $form) { $values = $form->getValues(); try { $this->authenticator->authenticate(array($this->user->getModel()->getEmail(), $values->oldPassword)); $this->userManager->changePassword($values); $form->presenter->flashMessage('Password was changed.', 'success'); } catch (\Exception $ex) { $form->addError($ex->getMessage()); } }