public function passwordFormSubmitted(Form $form) { $values = $form->getValues(); $user = $this->getUser(); try { $this->authenticator->authenticate(array($user->getIdentity()->username, $values->oldPassword)); $this->userRepository->setPassword($user->getId(), $values->newPassword); $this->flashMessage('Heslo bylo změněno.', 'success'); $this->redirect('Homepage:'); } catch (Nette\Security\AuthenticationException $e) { $form->addError('Zadané heslo není správné.'); } }