Skip to content

Commit 0d8eab6

Browse files
AC-6695: Guest Checkout Fix
1 parent f59a2fd commit 0d8eab6

File tree

1 file changed

+42
-38
lines changed

1 file changed

+42
-38
lines changed

app/code/Magento/Customer/Model/AccountManagement.php

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Magento\Customer\Model\Customer as CustomerModel;
2121
use Magento\Customer\Model\Customer\CredentialsValidator;
2222
use Magento\Customer\Model\ForgotPasswordToken\GetCustomerByToken;
23+
use Magento\Customer\Model\Logger as CustomerLogger;
2324
use Magento\Customer\Model\Metadata\Validator;
2425
use Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory;
2526
use Magento\Directory\Model\AllowedCountries;
@@ -57,7 +58,6 @@
5758
use Magento\Store\Model\ScopeInterface;
5859
use Magento\Store\Model\StoreManagerInterface;
5960
use Psr\Log\LoggerInterface as PsrLogger;
60-
use Magento\Customer\Model\Logger as CustomerLogger;
6161

6262
/**
6363
* Handle various customer account actions
@@ -72,7 +72,7 @@ class AccountManagement implements AccountManagementInterface
7272
/**
7373
* System Configuration Path for Enable/Disable Login at Guest Checkout
7474
*/
75-
private const GUEST_CHECKOUT_LOGIN_OPTION_SYS_CONFIG = 'checkout/options/disable_guest_checkout_login';
75+
private const GUEST_CHECKOUT_LOGIN_OPTION_SYS_CONFIG = 'checkout/options/enable_guest_checkout_login';
7676

7777
/**
7878
* Configuration paths for create account email template
@@ -223,177 +223,177 @@ class AccountManagement implements AccountManagementInterface
223223
/**
224224
* @var CustomerFactory
225225
*/
226-
private $customerFactory;
226+
private CustomerFactory $customerFactory;
227227

228228
/**
229229
* @var ValidationResultsInterfaceFactory
230230
*/
231-
private $validationResultsDataFactory;
231+
private ValidationResultsInterfaceFactory $validationResultsDataFactory;
232232

233233
/**
234234
* @var ManagerInterface
235235
*/
236-
private $eventManager;
236+
private ManagerInterface $eventManager;
237237

238238
/**
239239
* @var StoreManagerInterface
240240
*/
241-
private $storeManager;
241+
private StoreManagerInterface $storeManager;
242242

243243
/**
244244
* @var Random
245245
*/
246-
private $mathRandom;
246+
private Random $mathRandom;
247247

248248
/**
249249
* @var Validator
250250
*/
251-
private $validator;
251+
private Validator $validator;
252252

253253
/**
254254
* @var AddressRepositoryInterface
255255
*/
256-
private $addressRepository;
256+
private AddressRepositoryInterface $addressRepository;
257257

258258
/**
259259
* @var CustomerMetadataInterface
260260
*/
261-
private $customerMetadataService;
261+
private CustomerMetadataInterface $customerMetadataService;
262262

263263
/**
264264
* @var PsrLogger
265265
*/
266-
protected $logger;
266+
protected PsrLogger $logger;
267267

268268
/**
269269
* @var Encryptor
270270
*/
271-
private $encryptor;
271+
private Encryptor $encryptor;
272272

273273
/**
274274
* @var CustomerRegistry
275275
*/
276-
private $customerRegistry;
276+
private CustomerRegistry $customerRegistry;
277277

278278
/**
279279
* @var ConfigShare
280280
*/
281-
private $configShare;
281+
private ConfigShare $configShare;
282282

283283
/**
284284
* @var StringHelper
285285
*/
286-
protected $stringHelper;
286+
protected StringHelper $stringHelper;
287287

288288
/**
289289
* @var CustomerRepositoryInterface
290290
*/
291-
private $customerRepository;
291+
private CustomerRepositoryInterface $customerRepository;
292292

293293
/**
294294
* @var ScopeConfigInterface
295295
*/
296-
private $scopeConfig;
296+
private ScopeConfigInterface $scopeConfig;
297297

298298
/**
299299
* @var TransportBuilder
300300
*/
301-
private $transportBuilder;
301+
private TransportBuilder $transportBuilder;
302302

303303
/**
304304
* @var DataObjectProcessor
305305
*/
306-
protected $dataProcessor;
306+
protected DataObjectProcessor $dataProcessor;
307307

308308
/**
309309
* @var Registry
310310
*/
311-
protected $registry;
311+
protected Registry $registry;
312312

313313
/**
314314
* @var CustomerViewHelper
315315
*/
316-
protected $customerViewHelper;
316+
protected CustomerViewHelper $customerViewHelper;
317317

318318
/**
319319
* @var DateTime
320320
*/
321-
protected $dateTime;
321+
protected DateTime $dateTime;
322322

323323
/**
324324
* @var ObjectFactory
325325
*/
326-
protected $objectFactory;
326+
protected ObjectFactory $objectFactory;
327327

328328
/**
329329
* @var ExtensibleDataObjectConverter
330330
*/
331-
protected $extensibleDataObjectConverter;
331+
protected ExtensibleDataObjectConverter $extensibleDataObjectConverter;
332332

333333
/**
334334
* @var CustomerModel
335335
*/
336-
protected $customerModel;
336+
protected CustomerModel $customerModel;
337337

338338
/**
339339
* @var AuthenticationInterface
340340
*/
341-
protected $authentication;
341+
protected AuthenticationInterface $authentication;
342342

343343
/**
344344
* @var EmailNotificationInterface
345345
*/
346-
private $emailNotification;
346+
private EmailNotificationInterface $emailNotification;
347347

348348
/**
349349
* @var Backend
350350
*/
351-
private $eavValidator;
351+
private Backend $eavValidator;
352352

353353
/**
354354
* @var CredentialsValidator
355355
*/
356-
private $credentialsValidator;
356+
private CredentialsValidator $credentialsValidator;
357357

358358
/**
359359
* @var DateTimeFactory
360360
*/
361-
private $dateTimeFactory;
361+
private DateTimeFactory $dateTimeFactory;
362362

363363
/**
364364
* @var AccountConfirmation
365365
*/
366-
private $accountConfirmation;
366+
private AccountConfirmation $accountConfirmation;
367367

368368
/**
369369
* @var SearchCriteriaBuilder
370370
*/
371-
private $searchCriteriaBuilder;
371+
private SearchCriteriaBuilder $searchCriteriaBuilder;
372372

373373
/**
374374
* @var AddressRegistry
375375
*/
376-
private $addressRegistry;
376+
private AddressRegistry $addressRegistry;
377377

378378
/**
379379
* @var AllowedCountries
380380
*/
381-
private $allowedCountriesReader;
381+
private AllowedCountries $allowedCountriesReader;
382382

383383
/**
384384
* @var GetCustomerByToken
385385
*/
386-
private $getByToken;
386+
private GetCustomerByToken $getByToken;
387387

388388
/**
389389
* @var SessionCleanerInterface
390390
*/
391-
private $sessionCleaner;
391+
private SessionCleanerInterface $sessionCleaner;
392392

393393
/**
394394
* @var AuthorizationInterface
395395
*/
396-
private $authorization;
396+
private AuthorizationInterface $authorization;
397397

398398
/**
399399
* @var CustomerLogger
@@ -1142,6 +1142,10 @@ public function validate(CustomerInterface $customer)
11421142

11431143
/**
11441144
* @inheritdoc
1145+
*
1146+
* @param string $customerEmail
1147+
* @param int $websiteId
1148+
* @return bool
11451149
*/
11461150
public function isEmailAvailable(string $customerEmail, int $websiteId = null): bool
11471151
{
@@ -1151,7 +1155,7 @@ public function isEmailAvailable(string $customerEmail, int $websiteId = null):
11511155
$websiteId
11521156
);
11531157

1154-
if (!$guestLoginConfig) {
1158+
if ($guestLoginConfig === null || $guestLoginConfig === false) {
11551159
return true;
11561160
}
11571161

0 commit comments

Comments
 (0)