Пример #1
0
 /**
  * 
  * Change password 
  */
 public function updateAction()
 {
     // display form
     $request = $this->getRequest();
     $form = new Application_Form_Update();
     // process form
     if ($request->isPost()) {
         if ($form->isValid($request->getPost())) {
             $userMapper = new Application_Model_UserMapper();
             $auth = Zend_Auth::getInstance();
             $user = new Application_Model_User(get_object_vars($auth->getIdentity()));
             $user->setPassword($form->getValue('password'));
             $userMapper->save($user);
             $form = null;
             $this->view->msg = "Your password has been updated.";
         }
     }
     $this->view->form = $form;
 }
Пример #2
0
 public function saveAction()
 {
     $session = new Zend_Session_Namespace('session');
     if ($this->getRequest()->isPost()) {
         $form = new Application_Form_Update();
         $database_object = new Application_Model_Login();
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             if (!strlen($formData['username']) || !strlen($formData['firstname'])) {
                 $this->_redirect('/Login/Update');
                 return false;
             } else {
                 unset($formData['update']);
                 $database_object->update($session->id, $formData, 'users');
                 $this->_helper->redirector('welcome', 'Login');
             }
         }
     }
 }