diff --git a/frontend/assets/AppAsset.php b/frontend/assets/AppAsset.php index 177872e..9a4687f 100755 --- a/frontend/assets/AppAsset.php +++ b/frontend/assets/AppAsset.php @@ -30,7 +30,7 @@ class AppAsset extends AssetBundle ]; public $depends = [ 'yii\web\YiiAsset', - 'yii\bootstrap\BootstrapAsset', + 'yii\bootstrap\BootstrapPluginAsset', ]; public $jsOptions = array( 'position' => \yii\web\View::POS_HEAD diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index ddf5362..b74c460 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -123,59 +123,7 @@ class SiteController extends Controller public function actionLogin() { - // creat new model table Social and new model User - $social = new Social(); - $user = new User(); - - $serviceName = Yii::$app->getRequest()->getQueryParam('service'); - - if (isset($serviceName)) { - /** @var $eauth \nodge\eauth\ServiceBase */ - $eauth = Yii::$app->get('eauth')->getIdentity($serviceName); - $eauth->setRedirectUrl(Yii::$app->getUser()->getReturnUrl()); - $eauth->setCancelUrl(Yii::$app->getUrlManager()->createAbsoluteUrl('site/login')); - - try { - if ($eauth->authenticate()) { - $identity = User::findByEAuth($eauth); - Yii::$app->getUser()->login($identity); - - //Save date get social network in database - if (! $social::find()->where(['social_user_id' => $identity[profile][id], 'social_name' => $identity[profile][service]])->exists()) { - $name = explode(' ',$identity[profile][name]); - $user->firstname = $name[0]; - $user->lastname = $name[1]; - $user->id_system_date = date("d.m.y.H:i:s"); - $user->save(); - $social->social_name = $identity[profile][service]; - $social->social_user_id = $identity[profile][id]; - $social->user_id = $user->id; - $social->validate(); - $social->errors; - $social->save(); - } - // 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()); - } - } - - - - if (!\Yii::$app->user->isGuest) { return $this->goHome(); } @@ -188,6 +136,72 @@ class SiteController extends Controller 'model' => $model, ]); } + +// // creat new model table Social and new model User +// $social = new Social(); +// $user = new User(); +// +// $serviceName = Yii::$app->getRequest()->getQueryParam('service'); +// +// if (isset($serviceName)) { +// /** @var $eauth \nodge\eauth\ServiceBase */ +// $eauth = Yii::$app->get('eauth')->getIdentity($serviceName); +// $eauth->setRedirectUrl(Yii::$app->getUser()->getReturnUrl()); +// $eauth->setCancelUrl(Yii::$app->getUrlManager()->createAbsoluteUrl('site/login')); +// +// try { +// if ($eauth->authenticate()) { +// $identity = User::findByEAuth($eauth); +// Yii::$app->getUser()->login($identity); +// +// //Save date get social network in database +// if (! $social::find()->where(['social_user_id' => $identity[profile][id], 'social_name' => $identity[profile][service]])->exists()) { +// $name = explode(' ',$identity[profile][name]); +// $user->firstname = $name[0]; +// $user->lastname = $name[1]; +// $user->id_system_date = date("d.m.y.H:i:s"); +// $user->save(); +// $social->social_name = $identity[profile][service]; +// $social->social_user_id = $identity[profile][id]; +// $social->user_id = $user->id; +// $social->validate(); +// $social->errors; +// $social->save(); +// } +// +// // 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()); +// } +// } +// +// +// +// +// if (!\Yii::$app->user->isGuest) { +// return $this->goHome(); +// } +// +// $model = new LoginForm(); +// if ($model->load(Yii::$app->request->post()) && $model->login()) { +// return $this->goBack(); +// } else { +// return $this->render('login', [ +// 'model' => $model, +// ]); +// } } /** @@ -328,7 +342,7 @@ class SiteController extends Controller } } } - if(hasErrors) { + if($hasErrors) { $data['option_values'] = $option_values; return $this->render('options', ['options' => $data, 'post' => $post]); } else { diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index 231d75e..1d3c63a 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -48,9 +48,17 @@ AppAsset::register($this);