diff --git a/Controller/Social/Login.php b/Controller/Social/Login.php index 4a5998f..d115f92 100755 --- a/Controller/Social/Login.php +++ b/Controller/Social/Login.php @@ -90,7 +90,8 @@ public function execute() } $customer = $this->createCustomerProcess($userProfile, $type); - } elseif ($this->apiHelper->isCheckMode()) { + } + if ($this->apiHelper->isCheckMode()) { if ($customerData->getData('password_hash') === null) { $userProfile->hash = ''; $this->session->setUserProfile($userProfile); @@ -104,20 +105,7 @@ public function execute() ) ); } - - $userProfile->hash = $customerData->getData('password_hash'); - $this->session->setUserProfile($userProfile); - - return $this->_appendJs( - sprintf( - "", - $type, - $userProfile->firstName, - $userProfile->lastName - ) - ); } - $this->refresh($customer); return $this->_appendJs(); diff --git a/Helper/Social.php b/Helper/Social.php index c3b82ef..c62399f 100644 --- a/Helper/Social.php +++ b/Helper/Social.php @@ -99,6 +99,7 @@ public function getSocialConfig($type) 'Github' => ['wrapper' => ['class' => GitHub::class]], 'Amazon' => ['wrapper' => ['class' => Amazon::class]], 'Google' => ['scope' => 'profile email'], + 'Yahoo' => ['scope' => 'profile'], 'Zalo' => ['wrapper' => ['class' => Zalo::class], 'scope' => 'access_profile'] ]; @@ -181,6 +182,8 @@ public function getAuthUrl($type) break; case 'Yahoo': case 'Twitter': + case 'Vkontakte': + case 'Pinterest': case 'Zalo': return $authUrl; default: diff --git a/Model/Providers/Vkontakte.php b/Model/Providers/Vkontakte.php index d400c7e..1d22242 100755 --- a/Model/Providers/Vkontakte.php +++ b/Model/Providers/Vkontakte.php @@ -26,7 +26,7 @@ class Vkontakte extends Hybrid_Provider_Model_OAuth2 { public $scope = 'email'; - public $version = '5.0'; + public $version = '5.107'; public $fields = [ 'identifier' => 'id', diff --git a/Model/Social.php b/Model/Social.php index 14b3ed2..aaf0fa8 100755 --- a/Model/Social.php +++ b/Model/Social.php @@ -155,12 +155,14 @@ protected function _construct() */ public function getCustomerBySocial($identify, $type) { + $websiteId = $this->storeManager->getWebsite()->getId(); $customer = $this->customerFactory->create(); $socialCustomer = $this->getCollection() ->addFieldToFilter('social_id', $identify) ->addFieldToFilter('type', $type) ->addFieldToFilter('status', ['null' => 'true']) + ->addFieldToFilter('website_id', $websiteId) ->getFirstItem(); if ($socialCustomer && $socialCustomer->getId()) { @@ -214,7 +216,7 @@ public function createCustomerSocial($data, $store) $customer = $this->customerRepository->save($customer, $data['password']); $this->getEmailNotification()->newAccount( $customer, - EmailNotificationInterface::NEW_ACCOUNT_EMAIL_REGISTERED + EmailNotificationInterface::NEW_ACCOUNT_EMAIL_REGISTERED,'',$store->getId() ); } else { // If customer exists existing hash will be used by Repository @@ -230,7 +232,9 @@ public function createCustomerSocial($data, $store) if ($this->apiHelper->canSendPassword($store)) { $this->getEmailNotification()->newAccount( $customer, - EmailNotificationInterface::NEW_ACCOUNT_EMAIL_REGISTERED_NO_PASSWORD + EmailNotificationInterface::NEW_ACCOUNT_EMAIL_REGISTERED_NO_PASSWORD, + '', + $store->getId() ); } @@ -281,7 +285,8 @@ public function setAuthorCustomer($identifier, $customerId, $type) 'customer_id' => $customerId, 'type' => $type, 'is_send_password_email' => $this->apiHelper->canSendPassword(), - 'social_created_at' => $this->_dateTime->date() + 'social_created_at' => $this->_dateTime->date(), + 'website_id' => $this->storeManager->getWebsite()->getId() ] ) ->setId(null)->save(); diff --git a/Setup/UpgradeSchema.php b/Setup/UpgradeSchema.php index 8669c2e..f7e5a21 100644 --- a/Setup/UpgradeSchema.php +++ b/Setup/UpgradeSchema.php @@ -86,6 +86,22 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con ); } } + + if (version_compare($context->getVersion(), '1.2.1', '<')) { + if ($installer->tableExists('mageplaza_social_customer')) { + $columns = [ + 'website_id' => [ + 'type' => Table::TYPE_INTEGER, + 'comment' => 'Website Id', + ] + ]; + + $tagTable = $installer->getTable('mageplaza_social_customer'); + foreach ($columns as $name => $definition) { + $connection->addColumn($tagTable, $name, $definition); + } + } + } $installer->endSetup(); } } diff --git a/composer.json b/composer.json index f53512e..7047f89 100755 --- a/composer.json +++ b/composer.json @@ -1,53 +1,53 @@ -{ - "name": "mageplaza/magento-2-social-login", - "description": "Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps", - "require": { - "mageplaza/module-core": "^1.4.5", - "mageplaza/module-smtp": "^1.2.6", - "mageplaza/module-google-recaptcha": "^1.0.2", - "mageplaza/module-two-factor-authentication": "^1.1.1", - "hybridauth/hybridauth": "^2.14.0" - }, - "require-dev": { - "roave/security-advisories": "dev-master" - }, - "type": "magento2-module", - "version": "2.10.2", - "license": "proprietary", - "authors": [ - { - "name": "Mageplaza", - "email": "support@mageplaza.com", - "homepage": "https://www.mageplaza.com", - "role": "Technical Support" - } - ], - "keywords": [ - "magento 2", - "social login", - "magento 2 social login", - "facebook login", - "Google Login", - "Instagram Login", - "LinkedIn Login", - "Microsoft Live Login", - "Twitter Login", - "Yahoo Login", - "FourSquare Login", - "Amazon Login", - "Login", - "mageplaza", - "google", - "facebook", - "twitter", - "social proof" - ], - "autoload": { - "files": [ - "registration.php" - ], - "psr-4": { - "Mageplaza\\SocialLogin\\": "" - } - } -} +{ + "name": "mageplaza/magento-2-social-login", + "description": "Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps", + "require": { + "mageplaza/module-core": "^1.4.12", + "mageplaza/module-smtp": "^1.11.2", + "mageplaza/module-google-recaptcha": "^1.2.2", + "mageplaza/module-two-factor-authentication": "^1.1.3", + "hybridauth/hybridauth": "^2.14.0" + }, + "require-dev": { + "roave/security-advisories": "dev-master" + }, + "type": "magento2-module", + "version": "2.10.3", + "license": "proprietary", + "authors": [ + { + "name": "Mageplaza", + "email": "support@mageplaza.com", + "homepage": "https://www.mageplaza.com", + "role": "Technical Support" + } + ], + "keywords": [ + "magento 2", + "social login", + "magento 2 social login", + "facebook login", + "Google Login", + "Instagram Login", + "LinkedIn Login", + "Microsoft Live Login", + "Twitter Login", + "Yahoo Login", + "FourSquare Login", + "Amazon Login", + "Login", + "mageplaza", + "google", + "facebook", + "twitter", + "social proof" + ], + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Mageplaza\\SocialLogin\\": "" + } + } +} diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index da8cf13..d02c83d 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -436,6 +436,13 @@ 1 + + Mageplaza\SocialLogin\Block\System\RedirectUrl + + + 1 + + diff --git a/etc/module.xml b/etc/module.xml index 06b5f00..134e960 100755 --- a/etc/module.xml +++ b/etc/module.xml @@ -21,7 +21,7 @@ */ --> - + diff --git a/view/frontend/web/js/popup.js b/view/frontend/web/js/popup.js index 62c3122..5a9693d 100755 --- a/view/frontend/web/js/popup.js +++ b/view/frontend/web/js/popup.js @@ -83,6 +83,7 @@ define( */ _create: function () { var self = this; + customerData.reload(true); this.initObject(); this.initLink(); this.initObserve(); diff --git a/view/frontend/web/js/provider.js b/view/frontend/web/js/provider.js index 18ba3f3..348db92 100755 --- a/view/frontend/web/js/provider.js +++ b/view/frontend/web/js/provider.js @@ -62,6 +62,7 @@ define( var model = { initialize: function () { var self = this; + customerData.reload(true); $(element).on( 'click', function () { self.openPopup();