public function signinAction() { if ($this->getRequest()->isPost()) { if ($this->params()->fromPost('password') === $this->params()->fromPost('passwordconfirm')) { $dm = $this->getServiceLocator()->get('doctrine.documentmanager.odm_default'); $user = new User(); $user->setLogin($this->params()->fromPost('email')); $user->setPassword(md5($this->params()->fromPost('password'))); $user->setEmail($this->params()->fromPost('email')); $dm->persist($user); $dm->flush(); $lastId = $user->getId(); $this->getLogin($this->params()->fromPost('email'), $this->params()->fromPost('password')); $this->flashMessenger()->addInfoMessage('Usuario creato correctamente'); return $this->redirect()->toRoute('post', array('controller' => 'post', 'action' => 'create')); } $this->flashMessenger()->addErrorMessage('Los datos introducidos son incorrectos. Las contraseñas no coinciden'); return $this->redirect()->toRoute('login', array('controller' => 'login', 'action' => 'signin')); } return new ViewModel(); }
/** * {@inheritDoc} */ public function setPassword($password) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setPassword', array($password)); return parent::setPassword($password); }