Skip to content

Commit

Permalink
Merge pull request #258 from mageplaza/2.3-develop
Browse files Browse the repository at this point in the history
2.3 develop
  • Loading branch information
haitv282 authored Jun 22, 2022
2 parents ade6b93 + c703360 commit f7bc7bd
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 72 deletions.
16 changes: 2 additions & 14 deletions Controller/Social/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -104,20 +105,7 @@ public function execute()
)
);
}

$userProfile->hash = $customerData->getData('password_hash');
$this->session->setUserProfile($userProfile);

return $this->_appendJs(
sprintf(
"<script>window.close();window.opener.fakeEmailCallback('%s','%s','%s');</script>",
$type,
$userProfile->firstName,
$userProfile->lastName
)
);
}

$this->refresh($customer);

return $this->_appendJs();
Expand Down
3 changes: 3 additions & 0 deletions Helper/Social.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']
];

Expand Down Expand Up @@ -181,6 +182,8 @@ public function getAuthUrl($type)
break;
case 'Yahoo':
case 'Twitter':
case 'Vkontakte':
case 'Pinterest':
case 'Zalo':
return $authUrl;
default:
Expand Down
2 changes: 1 addition & 1 deletion Model/Providers/Vkontakte.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
11 changes: 8 additions & 3 deletions Model/Social.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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
Expand All @@ -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()
);
}

Expand Down Expand Up @@ -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();
Expand Down
16 changes: 16 additions & 0 deletions Setup/UpgradeSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
106 changes: 53 additions & 53 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]",
"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": "[email protected]",
"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\\": ""
}
}
}
7 changes: 7 additions & 0 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,13 @@
<field id="is_enabled">1</field>
</depends>
</field>
<field id="redirect_url" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
<frontend_model>Mageplaza\SocialLogin\Block\System\RedirectUrl</frontend_model>
<label>Callback URL</label>
<depends>
<field id="is_enabled">1</field>
</depends>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Sort Order</label>
<depends>
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Mageplaza_SocialLogin" setup_version="1.2.0">
<module name="Mageplaza_SocialLogin" setup_version="1.2.1">
<sequence>
<module name="Mageplaza_Core"/>
</sequence>
Expand Down
1 change: 1 addition & 0 deletions view/frontend/web/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ define(
*/
_create: function () {
var self = this;
customerData.reload(true);
this.initObject();
this.initLink();
this.initObserve();
Expand Down
1 change: 1 addition & 0 deletions view/frontend/web/js/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ define(
var model = {
initialize: function () {
var self = this;
customerData.reload(true);
$(element).on(
'click', function () {
self.openPopup();
Expand Down

0 comments on commit f7bc7bd

Please sign in to comment.