/**
  * 
  * @param type $params
  * @return \yii\data\ActiveDataProvider
  */
 public function search($params = [])
 {
     $query = ServiceUser::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => WidgetPageSize::getPageSize()]]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     return $dataProvider;
 }
 /**
  * Users authorization via services.
  */
 public function actionLogin()
 {
     $serviceName = Yii::$app->getRequest()->getQueryParam('service');
     if (isset($serviceName)) {
         /** @var $eauth \nodge\eauth\ServiceBase */
         $eauth = Yii::$app->get('eauth')->getIdentity($serviceName);
         $eauth->setRedirectUrl('/');
         $eauth->setCancelUrl(Yii::$app->getUrlManager()->createAbsoluteUrl('site/login'));
         try {
             if ($eauth->authenticate()) {
                 $serviceUserClass = Yii::$app->getModule('eauth')->serviceUserClass;
                 $identity = $serviceUserClass::findByEAuth($eauth);
                 if (!$identity) {
                     $identity = new ServiceUser();
                     if (!$identity->register($eauth)) {
                         $identity = null;
                     }
                 } else {
                     Yii::$app->getUser()->login($identity);
                 }
                 // special redirect with closing popup window
                 $eauth->redirect();
             } else {
                 // close popup window and redirect to cancelUrl
                 $eauth->cancel();
             }
         } catch (\nodge\eauth\ErrorException $e) {
             // save error to show it later
             Yii::$app->getSession()->setFlash('error', 'EAuthException: ' . $e->getMessage());
             // close popup window and redirect to cancelUrl
             //				$eauth->cancel();
             $eauth->redirect($eauth->getCancelUrl());
         }
     }
     /*$model = new LoginForm();
       
       if ($model->load($_POST) && $model->login()) {
           return $this->goBack();
       } else {
           return $this->render('login', array(
               'model' => $model,
           ));
       }*/
 }