示例#1
0
 function defaultAction()
 {
     $this->result['top_image'] = IndexPageConfig::$IMAGE_TOP;
     if (HttpNamespace::isPost()) {
         $username = HttpNamespace::getPOST('username');
         $password = HttpNamespace::getPOST('password');
         if (empty($username) || empty($password)) {
             $this->result['error'] = '用户名和密码不能为空';
         } else {
             if (UserNamespace::login($username, $password)) {
                 if (self::$REQUEST['url']) {
                     HttpNamespace::redirect(self::$REQUEST['url']);
                 }
                 HttpNamespace::redirect(__APP__);
             }
             $this->result['error'] = '用户名或密码错误';
         }
     }
     $this->assign($this->result);
     $this->display();
 }
 public function defaultAction()
 {
     if (HttpNamespace::isPost()) {
         $this->_username = HttpNamespace::getPOST('username');
         $this->_password = HttpNamespace::getPOST('password');
         $this->_password2 = HttpNamespace::getPOST('password2');
         if ($this->_validator()) {
             if (UserNamespace::saveUser($this->_username, $this->_password)) {
                 if (UserNamespace::login($this->_username, $this->_password)) {
                     if (self::$REQUEST['url']) {
                         HttpNamespace::redirect(self::$REQUEST['url']);
                     }
                     HttpNamespace::redirect(__APP__);
                 } else {
                     HttpNamespace::redirect(UrlNamespace::loginUrl());
                 }
             }
         }
     }
     $this->assign($this->error);
     $this->display();
 }