From 280e92c2fbdbb8872e9c5c680fa06ed7feee396f Mon Sep 17 00:00:00 2001 From: Dmitryi Date: Thu, 26 Nov 2015 12:04:02 +0200 Subject: [PATCH] авторизация через соц сети --- common/config/main.php | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/LoginForm.php | 50 ++++++++++++++++++-------------------------------- common/models/User.php | 39 +++++++++++++++++++++++++++++++++++---- composer.json | 3 ++- composer.lock | 200 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------- frontend/controllers/SiteController.php | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-- frontend/views/site/login.php | 52 +++++++++++++++++++++++----------------------------- vendor/composer/autoload_classmap.php | 2 ++ vendor/composer/autoload_namespaces.php | 2 ++ vendor/composer/autoload_psr4.php | 1 + vendor/composer/installed.json | 483 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------- vendor/dmstr/yii2-adminlte-asset/CHANGELOG.md | 9 ++++++++- vendor/dmstr/yii2-adminlte-asset/example-views/phundament/app/layouts/main.php | 2 +- vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php | 14 ++++---------- vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/left.php | 14 +------------- vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/main.php | 2 +- vendor/dmstr/yii2-adminlte-asset/widgets/Menu.php | 3 +++ vendor/kartik-v/yii2-krajee-base/AnimateAsset.php | 2 +- vendor/kartik-v/yii2-krajee-base/AssetBundle.php | 19 ++++++++++--------- vendor/kartik-v/yii2-krajee-base/CHANGE.md | 73 +++++++++++++++++++++++++++++++++++++++++++------------------------------ vendor/kartik-v/yii2-krajee-base/Config.php | 13 +++++++++---- vendor/kartik-v/yii2-krajee-base/Html5Input.php | 52 ++++++++++++++++++++++++++++++++-------------------- vendor/kartik-v/yii2-krajee-base/Html5InputAsset.php | 4 ++-- vendor/kartik-v/yii2-krajee-base/InputWidget.php | 42 +++++++++++++++++++++++++++++++----------- vendor/kartik-v/yii2-krajee-base/Module.php | 4 ++-- vendor/kartik-v/yii2-krajee-base/PluginAssetBundle.php | 3 +-- vendor/kartik-v/yii2-krajee-base/README.md | 4 ++-- vendor/kartik-v/yii2-krajee-base/TranslationTrait.php | 24 ++++++++++++++++-------- vendor/kartik-v/yii2-krajee-base/Widget.php | 12 ++++++++---- vendor/kartik-v/yii2-krajee-base/WidgetAsset.php | 2 +- vendor/kartik-v/yii2-krajee-base/WidgetTrait.php | 52 ++++++++++++++++++++++++++++++++++++++++++++-------- vendor/kartik-v/yii2-krajee-base/assets/css/html5input.css | 2 +- vendor/kartik-v/yii2-krajee-base/assets/css/html5input.min.css | 2 +- vendor/kartik-v/yii2-krajee-base/assets/css/kv-widgets.css | 2 +- vendor/kartik-v/yii2-krajee-base/assets/css/kv-widgets.min.css | 2 +- vendor/rmrevin/yii2-fontawesome/.bowerrc | 4 ---- vendor/rmrevin/yii2-fontawesome/.scrutinizer.yml | 2 +- vendor/rmrevin/yii2-fontawesome/CHANGELOG.md | 11 +++++++++++ vendor/rmrevin/yii2-fontawesome/FA.php | 3 --- vendor/rmrevin/yii2-fontawesome/FontAwesome.php | 36 +++++++++++++++++++++++++++++++++++- vendor/rmrevin/yii2-fontawesome/README.md | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------- vendor/rmrevin/yii2-fontawesome/component/Icon.php | 3 ++- vendor/rmrevin/yii2-fontawesome/composer.json | 6 +++--- vendor/rmrevin/yii2-fontawesome/composer.lock | 3 ++- vendor/rmrevin/yii2-fontawesome/phpunit.xml.dist | 11 +++++++---- vendor/rmrevin/yii2-fontawesome/tests/unit/fontawesome/MainTest.php | 38 ++++++++++++++++++++++++++++++++++++++ vendor/yiisoft/extensions.php | 64 +++++++++++++++++++++++++++++++++++++--------------------------- 47 files changed, 1191 insertions(+), 435 deletions(-) delete mode 100644 vendor/rmrevin/yii2-fontawesome/.bowerrc diff --git a/common/config/main.php b/common/config/main.php index d484172..a288bcf 100644 --- a/common/config/main.php +++ b/common/config/main.php @@ -40,6 +40,125 @@ return [ 'authManager' => [ 'class' => 'yii\rbac\DbManager', ], + + //подключаем конфигурации API соц сетей для авторизации + + 'eauth' => [ + 'class' => 'nodge\eauth\EAuth', + 'popup' => true, // Use the popup window instead of redirecting. + 'cache' => false, // Cache component name or false to disable cache. Defaults to 'cache' on production environments. + 'cacheExpire' => 0, // Cache lifetime. Defaults to 0 - means unlimited. + 'httpClient' => [ + // uncomment this to use streams in safe_mode + //'useStreamsFallback' => true, + ], + 'services' => [ // You can change the providers and their classes. + 'google' => [ + // register your app here: https://code.google.com/apis/console/ + 'class' => 'nodge\eauth\services\GoogleOAuth2Service', + 'clientId' => 'artbox-1138', + 'clientSecret' => '', + 'title' => 'Google', + ], + 'twitter' => [ + // register your app here: https://dev.twitter.com/apps/new + 'class' => 'nodge\eauth\services\TwitterOAuth1Service', + 'key' => '8vReLxI63vTs98MBMqhvrszwy', + 'secret' => 'jOqNbHIkQw4cVKKJkgrMtaEeCcfbeT1GTik4pF6O9D7AmqcwOG', + ], + 'yandex' => [ + // register your app here: https://oauth.yandex.ru/client/my + 'class' => 'nodge\eauth\services\YandexOAuth2Service', + 'clientId' => 'ea13195ac0424ff8a190838bec41bb71', + 'clientSecret' => '911f2c9afcbf4f5f9319b3134c096c86', + 'title' => 'Yandex', + ], + 'facebook' => [ + // register your app here: https://developers.facebook.com/apps/ + 'class' => 'nodge\eauth\services\FacebookOAuth2Service', + 'clientId' => '1642047622727997', + 'clientSecret' => 'f5b7ba4f062a568678b764fc74cc416e', + ], + 'yahoo' => [ + 'class' => 'nodge\eauth\services\YahooOpenIDService', + //'realm' => '*.example.org', // your domain, can be with wildcard to authenticate on subdomains. + ], + 'linkedin' => [ + // register your app here: https://www.linkedin.com/secure/developer + 'class' => 'nodge\eauth\services\LinkedinOAuth1Service', + 'key' => '77s41eixn3dyvo', + 'secret' => '1xLZQ7RRK6RNjo4U', + 'title' => 'LinkedIn (OAuth1)', + ], + 'linkedin_oauth2' => [ + // register your app here: https://www.linkedin.com/secure/developer + 'class' => 'nodge\eauth\services\LinkedinOAuth2Service', + 'clientId' => '77s41eixn3dyvo', + 'clientSecret' => '1xLZQ7RRK6RNjo4U', + 'title' => 'LinkedIn (OAuth2)', + ], + 'github' => [ + // register your app here: https://github.com/settings/applications + 'class' => 'nodge\eauth\services\GitHubOAuth2Service', + 'clientId' => 'd00283b5cfb225cd1600', + 'clientSecret' => 'f482361fad7184819d452f421c8b09db60830b42', + ], + 'live' => [ + // register your app here: https://account.live.com/developers/applications/index + 'class' => 'nodge\eauth\services\LiveOAuth2Service', + 'clientId' => '00000000481796AE', + 'clientSecret' => 'rt9GiJrlKz3sE6CvdOeuwWyYbl1tQT03', + ], + 'steam' => [ + 'class' => 'nodge\eauth\services\SteamOpenIDService', + //'realm' => '*.example.org', // your domain, can be with wildcard to authenticate on subdomains. + ], + 'instagram' => [ + // register your app here: https://instagram.com/developer/register/ + 'class' => 'nodge\eauth\services\InstagramOAuth2Service', + 'clientId' => '...', + 'clientSecret' => '...', + ], + 'vkontakte' => [ + // register your app here: https://vk.com/editapp?act=create&site=1 + 'class' => 'nodge\eauth\services\VKontakteOAuth2Service', + 'clientId' => '5155388', + 'clientSecret' => 'jxgmdGVQw7huGKRpnX3a', + ], + 'mailru' => [ + // register your app here: http://api.mail.ru/sites/my/add + 'class' => 'nodge\eauth\services\MailruOAuth2Service', + 'clientId' => '739322', + 'clientSecret' => 'd6ce7be6ff791375adff58fe0e4460b2', + ], + 'odnoklassniki' => [ + // register your app here: http://dev.odnoklassniki.ru/wiki/pages/viewpage.action?pageId=13992188 + // ... or here: http://www.odnoklassniki.ru/dk?st.cmd=appsInfoMyDevList&st._aid=Apps_Info_MyDev + 'class' => 'nodge\eauth\services\OdnoklassnikiOAuth2Service', + 'clientId' => '...', + 'clientSecret' => '...', + 'clientPublic' => '...', + 'title' => 'Odnoklas.', + ], + ], + ], + + // (optionally) you can configure logging + 'log' => [ + 'targets' => [ + [ + 'class' => 'yii\log\FileTarget', + 'logFile' => '@app/runtime/logs/eauth.log', + 'categories' => ['nodge\eauth\*'], + 'logVars' => [], + ], + ], + ], + + /*========End======= + *end api sicial + * */ + ], 'language' => 'ru-RU' ]; diff --git a/common/models/LoginForm.php b/common/models/LoginForm.php index afc1c23..eee2366 100644 --- a/common/models/LoginForm.php +++ b/common/models/LoginForm.php @@ -1,78 +1,64 @@ hasErrors()) { - $user = $this->getUser(); - if (!$user || !$user->validatePassword($this->password)) { - $this->addError($attribute, 'Incorrect username or password.'); - } + $user = $this->getUser(); + if (!$user || !$user->validatePassword($this->password)) { + $this->addError('password', 'Incorrect username or password.'); } } - /** * Logs in a user using the provided username and password. - * * @return boolean whether the user is logged in successfully */ public function login() { if ($this->validate()) { - return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0); + return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0); } else { return false; } } - /** * Finds user by [[username]] * * @return User|null */ - protected function getUser() + private function getUser() { - if ($this->_user === null) { + if ($this->_user === false) { $this->_user = User::findByUsername($this->username); } - return $this->_user; } -} +} \ No newline at end of file diff --git a/common/models/User.php b/common/models/User.php index 21ec7ac..720697a 100644 --- a/common/models/User.php +++ b/common/models/User.php @@ -24,8 +24,13 @@ use developeruz\db_rbac\interfaces\UserRbacInterface; */ class User extends ActiveRecord implements IdentityInterface, UserRbacInterface { + /** + * @var array EAuth attributes + */ + const STATUS_DELETED = 0; const STATUS_ACTIVE = 10; + public $profile; /** * @inheritdoc @@ -59,10 +64,36 @@ class User extends ActiveRecord implements IdentityInterface, UserRbacInterface /** * @inheritdoc */ - public static function findIdentity($id) - { - return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]); - } + public static function findIdentity($id) { + if (Yii::$app->getSession()->has('user-'.$id)) { + return new self(Yii::$app->getSession()->get('user-'.$id)); + } + else { + return isset(self::$users[$id]) ? new self(self::$users[$id]) : null; + } + } + /** + * @param \nodge\eauth\ServiceBase $service + * @return User + * @throws ErrorException + */ + public static function findByEAuth($service) { + if (!$service->getIsAuthenticated()) { + throw new ErrorException('EAuth user should be authenticated before creating identity.'); + } + $id = $service->getServiceName().'-'.$service->getId(); + $attributes = array( + 'id' => $id, + 'username' => $service->getAttribute('name'), + 'authKey' => md5($id), + 'profile' => $service->getAttributes(), + ); + $attributes['profile']['service'] = $service->getServiceName(); + Yii::$app->getSession()->set('user-'.$id, $attributes); + return new self($attributes); + } + + public $authKey; /** * @inheritdoc diff --git a/composer.json b/composer.json index 55b907d..a2cf6a9 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ "dmstr/yii2-adminlte-asset": "2.*", "yiisoft/yii2-jui": "^2.0", "kartik-v/yii2-widget-select2": "@dev", - "developeruz/yii2-db-rbac": "*" + "developeruz/yii2-db-rbac": "*", + "nodge/yii2-eauth": "*" }, "require-dev": { "yiisoft/yii2-codeception": "*", diff --git a/composer.lock b/composer.lock index 603df36..2f55525 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "52ade047603d8461342b32b7f76785af", - "content-hash": "35117bfe670ed414624b171df746a308", + "hash": "6b310fccece1d1eddc11db43624c06ab", "packages": [ { "name": "almasaeed2010/adminlte", @@ -461,16 +460,16 @@ }, { "name": "dmstr/yii2-adminlte-asset", - "version": "2.2.3", + "version": "2.2.4", "source": { "type": "git", "url": "https://github.com/dmstr/yii2-adminlte-asset.git", - "reference": "45cffbfe90d79f3c405b4cc98f7f318ae372bb10" + "reference": "c842a15ceef4e903f70ac927ec3246e6d53e1148" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dmstr/yii2-adminlte-asset/zipball/45cffbfe90d79f3c405b4cc98f7f318ae372bb10", - "reference": "45cffbfe90d79f3c405b4cc98f7f318ae372bb10", + "url": "https://api.github.com/repos/dmstr/yii2-adminlte-asset/zipball/c842a15ceef4e903f70ac927ec3246e6d53e1148", + "reference": "c842a15ceef4e903f70ac927ec3246e6d53e1148", "shasum": "" }, "require": { @@ -511,7 +510,7 @@ "extension", "yii2" ], - "time": "2015-10-07 21:31:26" + "time": "2015-11-06 10:35:36" }, { "name": "ezyang/htmlpurifier", @@ -559,16 +558,16 @@ }, { "name": "kartik-v/yii2-krajee-base", - "version": "v1.7.7", + "version": "v1.7.8", "source": { "type": "git", "url": "https://github.com/kartik-v/yii2-krajee-base.git", - "reference": "c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19" + "reference": "f90b9ff515ced4e40ff5ec8156a5c9f7f51e2a7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19", - "reference": "c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19", + "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/f90b9ff515ced4e40ff5ec8156a5c9f7f51e2a7f", + "reference": "f90b9ff515ced4e40ff5ec8156a5c9f7f51e2a7f", "shasum": "" }, "require": { @@ -601,7 +600,7 @@ "widget", "yii2" ], - "time": "2015-06-16 05:19:57" + "time": "2015-11-22 06:35:23" }, { "name": "kartik-v/yii2-widget-select2", @@ -652,17 +651,178 @@ "time": "2015-09-22 03:10:57" }, { + "name": "lusitanian/oauth", + "version": "v0.3.6", + "source": { + "type": "git", + "url": "https://github.com/Lusitanian/PHPoAuthLib.git", + "reference": "4ce8c488971410233eb3b1e6d9ac4e81debb41d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/4ce8c488971410233eb3b1e6d9ac4e81debb41d5", + "reference": "4ce8c488971410233eb3b1e6d9ac4e81debb41d5", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*", + "predis/predis": "0.8.*@dev", + "symfony/http-foundation": "~2.1" + }, + "suggest": { + "ext-openssl": "Allows for usage of secure connections with the stream-based HTTP client.", + "predis/predis": "Allows using the Redis storage backend.", + "symfony/http-foundation": "Allows using the Symfony Session storage backend." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.1-dev" + } + }, + "autoload": { + "psr-0": { + "OAuth": "src", + "OAuth\\Unit": "tests" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "David Desberg", + "email": "david@daviddesberg.com" + }, + { + "name": "Pieter Hordijk", + "email": "info@pieterhordijk.com" + } + ], + "description": "PHP 5.3+ oAuth 1/2 Library", + "keywords": [ + "Authentication", + "authorization", + "oauth", + "security" + ], + "time": "2015-09-09 06:43:02" + }, + { + "name": "nodge/lightopenid", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/Nodge/LightOpenID.git", + "reference": "a5492cc0c932c557b7e9b54a6e5bbd85cc5fa041" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Nodge/LightOpenID/zipball/a5492cc0c932c557b7e9b54a6e5bbd85cc5fa041", + "reference": "a5492cc0c932c557b7e9b54a6e5bbd85cc5fa041", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "type": "library", + "autoload": { + "classmap": [ + "openid.php", + "provider/provider.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT License" + ], + "authors": [ + { + "name": "Mewp", + "homepage": "http://code.google.com/p/lightopenid/" + }, + { + "name": "Ignat Ignatov", + "homepage": "https://github.com/iignatov/LightOpenID" + } + ], + "description": "Lightweight PHP5 library for easy OpenID authentication.", + "homepage": "https://github.com/Nodge/LightOpenID", + "keywords": [ + "Authentication", + "OpenId" + ], + "time": "2013-08-31 16:48:56" + }, + { + "name": "nodge/yii2-eauth", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/Nodge/yii2-eauth.git", + "reference": "25963e78c6083734736187bff992dd9da60fd125" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Nodge/yii2-eauth/zipball/25963e78c6083734736187bff992dd9da60fd125", + "reference": "25963e78c6083734736187bff992dd9da60fd125", + "shasum": "" + }, + "require": { + "lib-curl": "*", + "lusitanian/oauth": "~0.3.0", + "nodge/lightopenid": "~1.1.0", + "php": ">=5.4.0", + "yiisoft/yii2": "*" + }, + "type": "yii2-extension", + "extra": { + "bootstrap": "nodge\\eauth\\Bootstrap" + }, + "autoload": { + "psr-4": { + "nodge\\eauth\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "New BSD License" + ], + "authors": [ + { + "name": "Maxim Zemskov", + "email": "nodge@yandex.ru", + "homepage": "http://nodge.ru/" + } + ], + "description": "Yii2 EAuth Extension. EAuth allows to authenticate users with accounts on other websites (Google, Facebook, Twitter, etc).", + "homepage": "https://github.com/Nodge/yii2-eauth", + "keywords": [ + "Authentication", + "OpenId", + "eauth", + "extension", + "oauth", + "yii2" + ], + "time": "2015-10-17 16:51:17" + }, + { "name": "rmrevin/yii2-fontawesome", - "version": "2.12.0", + "version": "2.12.2", "source": { "type": "git", "url": "https://github.com/rmrevin/yii2-fontawesome.git", - "reference": "51d33ec9d1d7edab2166f1d42668c1bc8d28c068" + "reference": "62308687477734c166753de0ad9e2333dc7dce32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rmrevin/yii2-fontawesome/zipball/51d33ec9d1d7edab2166f1d42668c1bc8d28c068", - "reference": "51d33ec9d1d7edab2166f1d42668c1bc8d28c068", + "url": "https://api.github.com/repos/rmrevin/yii2-fontawesome/zipball/62308687477734c166753de0ad9e2333dc7dce32", + "reference": "62308687477734c166753de0ad9e2333dc7dce32", "shasum": "" }, "require": { @@ -688,9 +848,9 @@ ], "authors": [ { - "name": "Roman Revin", - "email": "xgismox@gmail.com", - "homepage": "http://rmrevin.ru/" + "name": "Revin Roman", + "email": "roman@rmrevin.com", + "homepage": "https://rmrevin.com/" } ], "description": "Asset Bundle for Yii2 with Font Awesome", @@ -701,7 +861,7 @@ "font", "yii" ], - "time": "2015-08-15 16:50:16" + "time": "2015-11-20 09:17:45" }, { "name": "swiftmailer/swiftmailer", diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index f66584a..bd77425 100644 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -16,7 +16,8 @@ use yii\filters\VerbFilter; use yii\filters\AccessControl; use frontend\models\OptionsToValues; use yii\validators\EmailValidator; - +use common\models\User; +use yii\helpers\VarDumper; use common\models\Page; /** @@ -52,6 +53,11 @@ class SiteController extends Controller 'logout' => ['post'], ], ], + 'eauth' => [ + // required to disable csrf validation on OpenID requests + 'class' => \nodge\eauth\openid\ControllerBehavior::className(), + 'only' => ['login'], + ], ]; } @@ -94,6 +100,42 @@ class SiteController extends Controller */ 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(Yii::$app->getUser()->getReturnUrl()); + $eauth->setCancelUrl(Yii::$app->getUrlManager()->createAbsoluteUrl('site/login')); + + try { + if ($eauth->authenticate()) { +// var_dump($eauth->getIsAuthenticated(), $eauth->getAttributes()); exit; + + $identity = User::findByEAuth($eauth); + 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()); + } + } + + + + if (!\Yii::$app->user->isGuest) { return $this->goHome(); } @@ -126,7 +168,13 @@ class SiteController extends Controller * @return mixed */ public function actionContact() - { + { + + //Yii::$app->user->logout(); + $identity = Yii::$app->getUser()->getIdentity(); + var_dump($identity[profile]); + die(); + $model = new ContactForm(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { if ($model->sendEmail(Yii::$app->params['adminEmail'])) { @@ -217,6 +265,7 @@ class SiteController extends Controller $option_list = $option_model->find()->where(1)->all(); $option_values = array(); $post = \Yii::$app->request->post(); + if(!empty(\Yii::$app->request->post())) { $options_to_values = array(); $hasErrors = false; diff --git a/frontend/views/site/login.php b/frontend/views/site/login.php index fe67ee0..746a527 100644 --- a/frontend/views/site/login.php +++ b/frontend/views/site/login.php @@ -1,39 +1,33 @@ title = 'Login'; $this->params['breadcrumbs'][] = $this->title; ?> -
-

title) ?>

- -

Please fill out the following fields to login:

- -
-
- 'login-form']); ?> +

title); ?>

- field($model, 'username') ?> - - field($model, 'password')->passwordInput() ?> - - field($model, 'rememberMe')->checkbox() ?> +getSession()->hasFlash('error')) { + echo '
'.Yii::$app->getSession()->getFlash('error').'
'; + } +?> -
- If you forgot your password you can . -
+

Do you already have an account on one of these sites? Click the logo to log in with it here:

+ 'site/login')); ?> +
-
- 'btn btn-primary', 'name' => 'login-button']) ?> -
+

Please fill out the following fields to login:

- -
+ array('class' => 'form-horizontal', 'id' => 'login-form'))); ?> + field($model, 'username')->textInput(); ?> + field($model, 'password')->passwordInput(); ?> + field($model, 'rememberMe')->checkbox(); ?> +
+ 'btn btn-primary')); ?>
-
+ \ No newline at end of file diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 7a91153..229b13d 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -6,4 +6,6 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( + 'LightOpenID' => $vendorDir . '/nodge/lightopenid/openid.php', + 'LightOpenIDProvider' => $vendorDir . '/nodge/lightopenid/provider/provider.php', ); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php index 2c62e15..edeba18 100644 --- a/vendor/composer/autoload_namespaces.php +++ b/vendor/composer/autoload_namespaces.php @@ -7,6 +7,8 @@ $baseDir = dirname($vendorDir); return array( 'cebe\\gravatar\\' => array($vendorDir . '/cebe/yii2-gravatar'), + 'OAuth\\Unit' => array($vendorDir . '/lusitanian/oauth/tests'), + 'OAuth' => array($vendorDir . '/lusitanian/oauth/src'), 'HTMLPurifier' => array($vendorDir . '/ezyang/htmlpurifier/library'), 'Diff' => array($vendorDir . '/phpspec/php-diff/lib'), ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index ea9e652..f2e301e 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -16,6 +16,7 @@ return array( 'yii\\bootstrap\\' => array($vendorDir . '/yiisoft/yii2-bootstrap'), 'yii\\' => array($vendorDir . '/yiisoft/yii2'), 'rmrevin\\yii\\fontawesome\\' => array($vendorDir . '/rmrevin/yii2-fontawesome'), + 'nodge\\eauth\\' => array($vendorDir . '/nodge/yii2-eauth/src'), 'kartik\\select2\\' => array($vendorDir . '/kartik-v/yii2-widget-select2'), 'kartik\\base\\' => array($vendorDir . '/kartik-v/yii2-krajee-base'), 'dmstr\\' => array($vendorDir . '/dmstr/yii2-adminlte-asset'), diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 982df43..1b6e5d6 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -696,60 +696,6 @@ ] }, { - "name": "rmrevin/yii2-fontawesome", - "version": "2.12.0", - "version_normalized": "2.12.0.0", - "source": { - "type": "git", - "url": "https://github.com/rmrevin/yii2-fontawesome.git", - "reference": "51d33ec9d1d7edab2166f1d42668c1bc8d28c068" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/rmrevin/yii2-fontawesome/zipball/51d33ec9d1d7edab2166f1d42668c1bc8d28c068", - "reference": "51d33ec9d1d7edab2166f1d42668c1bc8d28c068", - "shasum": "" - }, - "require": { - "bower-asset/fontawesome": "4.4.*", - "php": ">=5.4.0", - "yiisoft/yii2": "2.0.*" - }, - "time": "2015-08-15 16:50:16", - "type": "yii2-extension", - "extra": { - "asset-installer-paths": { - "npm-asset-library": "vendor/npm", - "bower-asset-library": "vendor/bower" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "rmrevin\\yii\\fontawesome\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Revin", - "email": "xgismox@gmail.com", - "homepage": "http://rmrevin.ru/" - } - ], - "description": "Asset Bundle for Yii2 with Font Awesome", - "keywords": [ - "asset", - "awesome", - "bundle", - "font", - "yii" - ] - }, - { "name": "almasaeed2010/adminlte", "version": "v2.3.2", "version_normalized": "2.3.2.0", @@ -837,62 +783,6 @@ ] }, { - "name": "dmstr/yii2-adminlte-asset", - "version": "2.2.3", - "version_normalized": "2.2.3.0", - "source": { - "type": "git", - "url": "https://github.com/dmstr/yii2-adminlte-asset.git", - "reference": "45cffbfe90d79f3c405b4cc98f7f318ae372bb10" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dmstr/yii2-adminlte-asset/zipball/45cffbfe90d79f3c405b4cc98f7f318ae372bb10", - "reference": "45cffbfe90d79f3c405b4cc98f7f318ae372bb10", - "shasum": "" - }, - "require": { - "almasaeed2010/adminlte": "~2.0", - "cebe/yii2-gravatar": "1.*", - "rmrevin/yii2-fontawesome": "~2.9", - "yiisoft/yii2": "2.*", - "yiisoft/yii2-bootstrap": "2.*" - }, - "time": "2015-10-07 21:31:26", - "type": "yii2-extension", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "dmstr\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Tobias Munk", - "email": "tobias@diemeisterei.de" - }, - { - "name": "Evgeniy Tkachenko", - "email": "et.coder@gmail.com" - } - ], - "description": "Backend theme for Yii2 Framework", - "keywords": [ - "AdminLTE", - "extension", - "yii2" - ] - }, - { "name": "yiisoft/yii2-jui", "version": "2.0.4", "version_normalized": "2.0.4.0", @@ -945,54 +835,6 @@ ] }, { - "name": "kartik-v/yii2-krajee-base", - "version": "v1.7.7", - "version_normalized": "1.7.7.0", - "source": { - "type": "git", - "url": "https://github.com/kartik-v/yii2-krajee-base.git", - "reference": "c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19", - "reference": "c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19", - "shasum": "" - }, - "require": { - "yiisoft/yii2-bootstrap": "@dev" - }, - "time": "2015-06-16 05:19:57", - "type": "yii2-extension", - "installation-source": "dist", - "autoload": { - "psr-4": { - "kartik\\base\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kartik Visweswaran", - "email": "kartikv2@gmail.com", - "homepage": "http://www.krajee.com/" - } - ], - "description": "Base library and foundation components for all Yii2 Krajee extensions.", - "homepage": "https://github.com/kartik-v/yii2-krajee-base", - "keywords": [ - "base", - "extension", - "foundation", - "krajee", - "widget", - "yii2" - ] - }, - { "name": "bower-asset/jquery", "version": "2.1.4", "version_normalized": "2.1.4.0", @@ -1395,5 +1237,330 @@ "CC-BY-3.0" ], "description": "Font Awesome" + }, + { + "name": "dmstr/yii2-adminlte-asset", + "version": "2.2.4", + "version_normalized": "2.2.4.0", + "source": { + "type": "git", + "url": "https://github.com/dmstr/yii2-adminlte-asset.git", + "reference": "c842a15ceef4e903f70ac927ec3246e6d53e1148" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dmstr/yii2-adminlte-asset/zipball/c842a15ceef4e903f70ac927ec3246e6d53e1148", + "reference": "c842a15ceef4e903f70ac927ec3246e6d53e1148", + "shasum": "" + }, + "require": { + "almasaeed2010/adminlte": "~2.0", + "cebe/yii2-gravatar": "1.*", + "rmrevin/yii2-fontawesome": "~2.9", + "yiisoft/yii2": "2.*", + "yiisoft/yii2-bootstrap": "2.*" + }, + "time": "2015-11-06 10:35:36", + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "dmstr\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Tobias Munk", + "email": "tobias@diemeisterei.de" + }, + { + "name": "Evgeniy Tkachenko", + "email": "et.coder@gmail.com" + } + ], + "description": "Backend theme for Yii2 Framework", + "keywords": [ + "AdminLTE", + "extension", + "yii2" + ] + }, + { + "name": "nodge/lightopenid", + "version": "1.1.2", + "version_normalized": "1.1.2.0", + "source": { + "type": "git", + "url": "https://github.com/Nodge/LightOpenID.git", + "reference": "a5492cc0c932c557b7e9b54a6e5bbd85cc5fa041" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Nodge/LightOpenID/zipball/a5492cc0c932c557b7e9b54a6e5bbd85cc5fa041", + "reference": "a5492cc0c932c557b7e9b54a6e5bbd85cc5fa041", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "time": "2013-08-31 16:48:56", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "openid.php", + "provider/provider.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT License" + ], + "authors": [ + { + "name": "Mewp", + "homepage": "http://code.google.com/p/lightopenid/" + }, + { + "name": "Ignat Ignatov", + "homepage": "https://github.com/iignatov/LightOpenID" + } + ], + "description": "Lightweight PHP5 library for easy OpenID authentication.", + "homepage": "https://github.com/Nodge/LightOpenID", + "keywords": [ + "Authentication", + "OpenId" + ] + }, + { + "name": "lusitanian/oauth", + "version": "v0.3.6", + "version_normalized": "0.3.6.0", + "source": { + "type": "git", + "url": "https://github.com/Lusitanian/PHPoAuthLib.git", + "reference": "4ce8c488971410233eb3b1e6d9ac4e81debb41d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/4ce8c488971410233eb3b1e6d9ac4e81debb41d5", + "reference": "4ce8c488971410233eb3b1e6d9ac4e81debb41d5", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*", + "predis/predis": "0.8.*@dev", + "symfony/http-foundation": "~2.1" + }, + "suggest": { + "ext-openssl": "Allows for usage of secure connections with the stream-based HTTP client.", + "predis/predis": "Allows using the Redis storage backend.", + "symfony/http-foundation": "Allows using the Symfony Session storage backend." + }, + "time": "2015-09-09 06:43:02", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "OAuth": "src", + "OAuth\\Unit": "tests" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "David Desberg", + "email": "david@daviddesberg.com" + }, + { + "name": "Pieter Hordijk", + "email": "info@pieterhordijk.com" + } + ], + "description": "PHP 5.3+ oAuth 1/2 Library", + "keywords": [ + "Authentication", + "authorization", + "oauth", + "security" + ] + }, + { + "name": "nodge/yii2-eauth", + "version": "2.3.0", + "version_normalized": "2.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/Nodge/yii2-eauth.git", + "reference": "25963e78c6083734736187bff992dd9da60fd125" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Nodge/yii2-eauth/zipball/25963e78c6083734736187bff992dd9da60fd125", + "reference": "25963e78c6083734736187bff992dd9da60fd125", + "shasum": "" + }, + "require": { + "lib-curl": "*", + "lusitanian/oauth": "~0.3.0", + "nodge/lightopenid": "~1.1.0", + "php": ">=5.4.0", + "yiisoft/yii2": "*" + }, + "time": "2015-10-17 16:51:17", + "type": "yii2-extension", + "extra": { + "bootstrap": "nodge\\eauth\\Bootstrap" + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "nodge\\eauth\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "New BSD License" + ], + "authors": [ + { + "name": "Maxim Zemskov", + "email": "nodge@yandex.ru", + "homepage": "http://nodge.ru/" + } + ], + "description": "Yii2 EAuth Extension. EAuth allows to authenticate users with accounts on other websites (Google, Facebook, Twitter, etc).", + "homepage": "https://github.com/Nodge/yii2-eauth", + "keywords": [ + "Authentication", + "OpenId", + "eauth", + "extension", + "oauth", + "yii2" + ] + }, + { + "name": "kartik-v/yii2-krajee-base", + "version": "v1.7.8", + "version_normalized": "1.7.8.0", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-krajee-base.git", + "reference": "f90b9ff515ced4e40ff5ec8156a5c9f7f51e2a7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/f90b9ff515ced4e40ff5ec8156a5c9f7f51e2a7f", + "reference": "f90b9ff515ced4e40ff5ec8156a5c9f7f51e2a7f", + "shasum": "" + }, + "require": { + "yiisoft/yii2-bootstrap": "@dev" + }, + "time": "2015-11-22 06:35:23", + "type": "yii2-extension", + "installation-source": "dist", + "autoload": { + "psr-4": { + "kartik\\base\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "Base library and foundation components for all Yii2 Krajee extensions.", + "homepage": "https://github.com/kartik-v/yii2-krajee-base", + "keywords": [ + "base", + "extension", + "foundation", + "krajee", + "widget", + "yii2" + ] + }, + { + "name": "rmrevin/yii2-fontawesome", + "version": "2.12.2", + "version_normalized": "2.12.2.0", + "source": { + "type": "git", + "url": "https://github.com/rmrevin/yii2-fontawesome.git", + "reference": "62308687477734c166753de0ad9e2333dc7dce32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rmrevin/yii2-fontawesome/zipball/62308687477734c166753de0ad9e2333dc7dce32", + "reference": "62308687477734c166753de0ad9e2333dc7dce32", + "shasum": "" + }, + "require": { + "bower-asset/fontawesome": "4.4.*", + "php": ">=5.4.0", + "yiisoft/yii2": "2.0.*" + }, + "time": "2015-11-20 09:17:45", + "type": "yii2-extension", + "extra": { + "asset-installer-paths": { + "npm-asset-library": "vendor/npm", + "bower-asset-library": "vendor/bower" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "rmrevin\\yii\\fontawesome\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Revin Roman", + "email": "roman@rmrevin.com", + "homepage": "https://rmrevin.com/" + } + ], + "description": "Asset Bundle for Yii2 with Font Awesome", + "keywords": [ + "asset", + "awesome", + "bundle", + "font", + "yii" + ] } ] diff --git a/vendor/dmstr/yii2-adminlte-asset/CHANGELOG.md b/vendor/dmstr/yii2-adminlte-asset/CHANGELOG.md index a1adb8d..5e963fe 100644 --- a/vendor/dmstr/yii2-adminlte-asset/CHANGELOG.md +++ b/vendor/dmstr/yii2-adminlte-asset/CHANGELOG.md @@ -1,6 +1,13 @@ CHANGELOG --------- +## 2.2.4 + * [FIX] fixed active menu with modules (Vasiliy Baranov) + * [ENH] added .hold-transition + +## 2.2.3 + * [ENH] : updated Gravatar widget E-Mail usage (@Quexer69) + ## 2.2.2 * fixed Menu widget selection * updated example views @@ -114,4 +121,4 @@ CHANGELOG * fixed missing csrf token, updated menu, code-formatting * updated paths, added Phundament 4 template * update README.md - * initial commit \ No newline at end of file + * initial commit diff --git a/vendor/dmstr/yii2-adminlte-asset/example-views/phundament/app/layouts/main.php b/vendor/dmstr/yii2-adminlte-asset/example-views/phundament/app/layouts/main.php index 7aa21d0..cb22270 100644 --- a/vendor/dmstr/yii2-adminlte-asset/example-views/phundament/app/layouts/main.php +++ b/vendor/dmstr/yii2-adminlte-asset/example-views/phundament/app/layouts/main.php @@ -29,7 +29,7 @@ dmstr\web\AdminLteAsset::register($this); - + beginBody() ?>
diff --git a/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php b/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php index 9149654..543feed 100644 --- a/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php +++ b/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php @@ -1,9 +1,5 @@ user->identity->firstname.' '.Yii::$app->user->identity->lastname; /* @var $this \yii\web\View */ /* @var $content string */ @@ -234,7 +230,7 @@ $username = Yii::$app->user->identity->firstname.' '.Yii::$app->user->identity->