/**
  * @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());
     }
 }
示例#2
0
 /**
  * @param $values
  * @return Post
  */
 protected function create($values)
 {
     $post = new \Flame\CMS\PostBundle\Model\Post($this->user->getModel(), $values['name'], $values['slug'], $values['content'], $values['category']);
     $post->setComment($values['comment'])->setPublish($values['publish'])->setKeywords($values['keywords'])->setDescription($values['description'])->setTags((array) $values['tags']);
     $this->postFacade->save($post);
     return $post;
 }