39
39
use Magento \Customer \Controller \AbstractAccount ;
40
40
41
41
/**
42
+ * Post create customer action
43
+ *
42
44
* @SuppressWarnings(PHPMD.TooManyFields)
43
45
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
44
46
*/
@@ -158,8 +160,8 @@ class CreatePost extends AbstractAccount implements CsrfAwareActionInterface, Ht
158
160
* @param CustomerExtractor $customerExtractor
159
161
* @param DataObjectHelper $dataObjectHelper
160
162
* @param AccountRedirect $accountRedirect
161
- * @param Validator $formKeyValidator
162
163
* @param CustomerRepository $customerRepository
164
+ * @param Validator $formKeyValidator
163
165
*
164
166
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
165
167
*/
@@ -337,22 +339,16 @@ public function execute()
337
339
return $ this ->resultRedirectFactory ->create ()
338
340
->setUrl ($ this ->_redirect ->error ($ url ));
339
341
}
340
-
341
342
$ this ->session ->regenerateId ();
342
-
343
343
try {
344
344
$ address = $ this ->extractAddress ();
345
345
$ addresses = $ address === null ? [] : [$ address ];
346
-
347
346
$ customer = $ this ->customerExtractor ->extract ('customer_account_create ' , $ this ->_request );
348
347
$ customer ->setAddresses ($ addresses );
349
-
350
348
$ password = $ this ->getRequest ()->getParam ('password ' );
351
349
$ confirmation = $ this ->getRequest ()->getParam ('password_confirmation ' );
352
350
$ redirectUrl = $ this ->session ->getBeforeAuthUrl ();
353
-
354
351
$ this ->checkPasswordConfirmation ($ password , $ confirmation );
355
-
356
352
$ customer = $ this ->accountManagement
357
353
->createAccount ($ customer , $ password , $ redirectUrl );
358
354
@@ -362,12 +358,10 @@ public function execute()
362
358
$ customer ->setExtensionAttributes ($ extensionAttributes );
363
359
$ this ->customerRepository ->save ($ customer );
364
360
}
365
-
366
361
$ this ->_eventManager ->dispatch (
367
362
'customer_register_success ' ,
368
363
['account_controller ' => $ this , 'customer ' => $ customer ]
369
364
);
370
-
371
365
$ confirmationStatus = $ this ->accountManagement ->getConfirmationStatus ($ customer ->getId ());
372
366
if ($ confirmationStatus === AccountManagementInterface::ACCOUNT_CONFIRMATION_REQUIRED ) {
373
367
$ email = $ this ->customerUrl ->getEmailConfirmationUrl ($ customer ->getEmail ());
0 commit comments