Ejemplo n.º 1
0
 /** Change a password
  * @access public
  * @return void
  */
 public function changepasswordAction()
 {
     $form = new ChangePasswordForm();
     $this->view->form = $form;
     if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) {
         if ($form->isValid($form->getValues())) {
             $password = SHA1($this->_helper->config()->auth->salt . $form->getValue('password'));
             $where = array();
             $where[] = $this->_users->getAdapter()->quoteInto('id = ?', $this->getIdentityForForms());
             $this->_users->update(array('password' => $password), $where);
             $this->getFlash()->addMessage('You have changed your password');
             $this->redirect('/users/account/');
         } else {
             $form->populate($form->getValues());
         }
     }
 }