Beispiel #1
0
 public static function getInstance(SysAdmin $user = NULL)
 {
     if (self::$_instance instanceof AdminManage) {
         return self::$_instance;
     } else {
         return self::$_instance = new AdminManage($user);
     }
 }
Beispiel #2
0
 /**
  * 系统管理员登录
  */
 private function adminLogin()
 {
     $adminManager = AdminManage::getInstance();
     $postData = $this->input->post(NULL, true);
     $loginMsg = $adminManager->login($postData);
     if ($loginMsg === true) {
         //保存用户名到cookies中
         if ($this->input->post('keepme') == '1') {
             $cookie_username = $this->encrypt->encode($postData['username']);
             $this->input->set_cookie(self::COOKIE_USER_NAME_TAG, $cookie_username, 86400 * 365);
         }
         redirect('/admin', 'location');
     } else {
         $this->displayLoginHtml(array('errMsg' => "登录失败,{$loginMsg}"));
     }
 }
Beispiel #3
0
 public function do_change_password()
 {
     if (!$this->input->is_post() || empty($_POST)) {
         $this->_redirect('change_password');
     }
     $postData = $this->input->post(NULL, TRUE);
     if (empty($postData['password']) || empty($postData['newpassword'])) {
         $postData['errMsg'] = "密码不能为空,必须填写";
         $this->displayHtml($postData, 'change_password');
     }
     $rs = AdminManage::getInstance()->changePassword($postData['password'], $postData['newpassword']);
     if ($rs === true) {
         $_SESSION['change_password_success'] = $rs;
         $this->_redirect('change_password_success');
     } else {
         $postData['errMsg'] = $rs;
         $this->displayHtml($postData, 'change_password');
     }
 }