public function actionRegister()
 {
     $tpl_data = array();
     $model = new FrontuserLoginForm('register');
     $tpl_data['model'] = $model;
     if (isset($_POST['FrontuserLoginForm'])) {
         $model->attributes = $_POST['FrontuserLoginForm'];
         if (!$this->createAction('captcha')->validate($model->verifyCode, false)) {
             $this->createAction('captcha')->getVerifyCode(true);
             Yii::app()->user->setFlash('register', 'Verify Code Error');
             $this->render('register', $tpl_data);
             return;
         }
         $this->createAction('captcha')->getVerifyCode(true);
         if ($model->validate()) {
             $user = new Frontuser();
             $user->username = $model->username;
             $user->pwd = $model->password;
             $user->email = $model->email;
             $user->status = 1;
             $user->regtime = time();
             $user->logintime = time();
             $user->save(false);
             FrontuserHelper::login($model->username, $model->password);
             $this->redirect(array('user/index'));
         }
     }
     $this->render('register', $tpl_data);
 }
 public static function getLoginUser()
 {
     if (self::checkLogin()) {
         $user = Frontuser::model()->findByPk(Yii::app()->session['frontuid']);
         return $user;
     }
     return null;
 }