示例#1
0
 public function loginSubmitAction()
 {
     if ($this->request->isPost()) {
         // $type = $this->request->getPost('type');
         //Taking the variables sent by POST
         //            $mobile = $this->request->getPost('mobile');
         //            $email = $this->request->getPost('email');
         $account_id = $this->request->getPost('account_id');
         $password = $this->request->getPost('password');
         $img_verity = $this->request->getPost('img_verity');
         //$res=$this->checkVerity($img_verity);
         //            if(!$res){
         //                $this->flash->error('验证码错误');
         //                return $this->dispatcher->forward(array(
         //                    'controller' => 'user',
         //                    'action' => 'login'
         //                ));
         //            }
         $mobile = $account_id;
         $email = $account_id;
         $ubm = new DtbUserBasic();
         $user = $ubm->login(0, $mobile, $email, $password);
         if ($user) {
             $this->_registerSession($user);
             $this->_registerCookie($user);
             //$this->cookies->set('role','Common',time()+86400,'/');
             $this->flash->success('Welcome ' . $user->getNickname());
             return $this->response->redirect('/user/center');
             return $this->dispatcher->forward(array('controller' => 'user', 'action' => 'center'));
         } else {
             $this->flash->error('Wrong user/password');
             return $this->dispatcher->forward(array('controller' => 'user', 'action' => 'login'));
         }
     } else {
         die('xxx');
     }
 }