Ejemplo n.º 1
0
 /**
  * Allows users to change their passwords
  *
  * @access public
  * @return void
  */
 public function changePasswordAction()
 {
     $this->title = 'Change password';
     $user = Zend_Auth::getInstance()->getIdentity();
     if ($user->id == 1) {
         $this->_helper->FlashMessenger(array('msg-warn' => 'Please don\'t change the admin password in this release.'));
         $this->_redirect('/profile/');
     }
     $form = new ChangePasswordForm();
     $userModel = new BackofficeUser();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $userModel->changePassword($form->getValue('password'));
             $this->_helper->FlashMessenger(array('msg-success' => 'Your password was successfully changed.'));
             $this->_redirect('/profile/');
         }
     }
     $this->view->form = $form;
 }
Ejemplo n.º 2
0
 /**
  * Change password action, Allow the User to change his password 
  * @author EL GUENNUNI Sohaib s.elguennuni@gmail.com
  * @param <empty>
  * @return <empty>
  */
 public function changepwAction()
 {
     $this->title = 'Change password';
     $form = new ChangePasswordForm();
     $user = Zend_Auth::getInstance()->getIdentity();
     if ($user->id == 1) {
         $this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'account', 'action' => 'display'), 'default', true));
     }
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         if ($form->isValid($formData)) {
             ${$this}->_userModel->changePassword($form->getValue('password'));
             $this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'account', 'action' => 'display'), 'default', true));
         } else {
             $form->populate($formData);
         }
     }
     $this->view->form = $form;
 }
Ejemplo n.º 3
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());
         }
     }
 }