Beispiel #1
0
 public function changePasswordAction()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $user = new Security_Model_User();
     $model = $user->find($usersNs->userId);
     $request = $this->getRequest();
     $form = new Application_Form_ChangePassword();
     $elements = $form->getElements();
     $form->clearDecorators();
     foreach ($elements as $element) {
         $element->removeDecorator('label');
         $element->removeDecorator('Errors');
     }
     if ($request->isPost()) {
         $options = $request->getPost();
         if ($form->isValid($options)) {
             $model->setPassword(md5($options['password']));
             $model->save();
             $this->_flashMessenger->addMessage(array('success' => 'Your password has been changed successfully!'));
             $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/admin/dashboard'));
         } else {
             $this->view->password_msg = array_pop($form->getMessages('password'));
             $this->view->cpassword_msg = array_pop($form->getMessages('confirmPassword'));
             $form->reset();
             $form->populate($options);
         }
     }
     // Assign the form to the view
     $this->view->form = $form;
 }
Beispiel #2
0
 function changePasswordAction()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $user = new Application_Model_User();
     $model = $user->find($usersNs->userId);
     $request = $this->getRequest();
     $form = new Application_Form_ChangePassword();
     if ($request->isPost()) {
         $options = $request->getPost();
         if ($form->isValid($options)) {
             $model->setPassword(md5($options['password']));
             $model->save();
             $this->view->msg = "Your password changed successfully!";
         } else {
             $form->reset();
             $form->populate($options);
         }
     }
     // Assign the form to the view
     $this->view->form = $form;
 }