public function pwddoAction() { $vars = get_object_vars($this->reqs); if (User_Model_Account_Validate::isPasswordValid($vars, $msg)) { try { if ($this->session->uid != "0") { $_user = Core_Dao::factory(array('name' => 'user')); $user = $_user->getById($this->session->uid); if (isset($user['pass']) && md5($vars['pass_current']) == $user['pass']) { $set = array('pass' => md5($vars['pass'])); $where = array('id' => $this->session->uid); $_user->update($set, $where); $this->view->message = Core_Message::get('success', 'Success'); } else { $this->view->message = Core_Message::get('error', 'Current password do not match'); } } } catch (Exception $e) { $this->view->message = Core_Message::get('error', 'Current password do not match'); } } else { $this->view->message = Core_Message::get('error', $msg); } $this->pwdAction(); }
public function pwddoAction() { $params = $this->_params; if (User_Model_Account_Validate::isPasswordChange($params, $msg)) { try { if ($this->_session->uid != "0") { $_user = new Common_Db_User(); $user = $_user->getById($this->_session->uid); if (isset($user['pass']) && md5($params['pass_current']) == $user['pass']) { $set = array('pass' => md5($params['pass'])); $where = array('uid = ?' => $this->_session->uid); $_user->update($set, $where); $this->view->message = Common_Message::get('success', 'Success'); } else { $this->view->message = Common_Message::get('error', 'Current password do not match'); } } } catch (Exception $e) { $this->view->message = Common_Message::get('error', 'Current password do not match'); } } else { $this->view->message = Common_Message::get('error', $msg); } $this->loadLayout('layout-simple'); $this->render('pwd'); }