Example #1
0
 public function changePasswordAction()
 {
     if ($this->request->isPost()) {
         $user_id = $this->request->getPost('user_id');
         $old_password = $this->request->getPost('old_password');
         $new_password = $this->request->getPost('new_password');
         if (trim($old_password) == trim($new_password)) {
             $this->flash->error('新旧密码不能相同');
         }
         $user_basic = new DtbUserBasic();
         $result = $user_basic->changePassword($user_id, md5($new_password));
         if ($result) {
             $this->flash->success('修改成功');
             return $this->dispatcher->forward(array('controller' => 'User', 'action' => 'center'));
         } else {
             $this->flash->error('修改失败');
         }
     }
     $this->view->setVar('is_current', changepassword);
 }