Skip to content

Unable to reset password if customer has address from not allowed country #18170

@ihor-sviziev

Description

@ihor-sviziev

Preconditions

  1. Magento 2.2.5

Steps to reproduce

  1. Create customer on frontend, add some customer address with Germany (just an example) and log out
  2. Go to Admin >> Stores >> Configuration >> General >> General
  3. In Country Options >> Allow Countries deselect Germany (mark as not allowed), click to Save Config (probably flushing cache also required)
  4. On frontend got to "Forgot password" form and try to reset password for customer that you created in step 1

Expected result

  1. Customer should get reset password link without any issues

Actual result

  1. Customer get's the error "We're unable to send the password reset email."
    image
  2. In logs we have
[2018-09-21 06:09:22] main.CRITICAL: Exception message: Invalid value of "GB" provided for the countryId field.
Trace: #0 /path_to_magento/magento2/vendor/magento/module-customer/Model/ResourceModel/CustomerRepository.php(266): Magento\Customer\Model\ResourceModel\AddressRepository->save(Object(Magento\Customer\Model\Data\Address))
#1 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Customer\Model\ResourceModel\CustomerRepository->save(Object(Magento\Customer\Model\Data\Customer), NULL)
#2 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor->___callParent('save', Array)
#3 /path_to_magento/magento2/vendor/magento/module-customer/Model/Plugin/CustomerRepository/TransactionWrapper.php(44): Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Customer\Model\Data\Customer), NULL)
#4 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Customer\Model\Plugin\CustomerRepository\TransactionWrapper->aroundSave(Object(Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor), Object(Closure), Object(Magento\Customer\Model\Data\Customer))
#5 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Customer\Model\Data\Customer))
#6 /path_to_magento/magento2/generated/code/Magento/Customer/Model/ResourceModel/CustomerRepository/Interceptor.php(26): Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor->___callPlugins('save', Array, Array)
#7 /path_to_magento/magento2/vendor/magento/module-customer/Model/AccountManagement.php(1284): Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor->save(Object(Magento\Customer\Model\Data\Customer))
#8 /path_to_magento/magento2/generated/code/Magento/Customer/Model/AccountManagement/Interceptor.php(271): Magento\Customer\Model\AccountManagement->changeResetPasswordLinkToken(Object(Magento\Customer\Model\Data\Customer), 'e53fc7d535673c8...')
#9 /path_to_magento/magento2/vendor/magento/module-customer/Model/AccountManagement.php(567): Magento\Customer\Model\AccountManagement\Interceptor->changeResetPasswordLinkToken(Object(Magento\Customer\Model\Data\Customer), 'e53fc7d535673c8...')
#10 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Customer\Model\AccountManagement->initiatePasswordReset('[email protected]', 'email_reset', '4')
#11 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Customer\Model\AccountManagement\Interceptor->___callParent('initiatePasswor...', Array)
#12 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Customer\Model\AccountManagement\Interceptor->Magento\Framework\Interception\{closure}('[email protected]', 'email_reset')
#13 /path_to_magento/magento2/generated/code/Magento/Customer/Model/AccountManagement/Interceptor.php(91): Magento\Customer\Model\AccountManagement\Interceptor->___callPlugins('initiatePasswor...', Array, Array)
#14 /path_to_magento/magento2/vendor/magento/module-customer/Controller/Account/ForgotPasswordPost.php(76): Magento\Customer\Model\AccountManagement\Interceptor->initiatePasswordReset('[email protected]', 'email_reset')
#15 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Customer\Controller\Account\ForgotPasswordPost->execute()
#16 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Customer\Controller\Account\ForgotPasswordPost\Interceptor->___callParent('execute', Array)
#17 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Customer\Controller\Account\ForgotPasswordPost\Interceptor->Magento\Framework\Interception\{closure}()
#18 /path_to_magento/magento2/generated/code/Magento/Customer/Controller/Account/ForgotPasswordPost/Interceptor.php(26): Magento\Customer\Controller\Account\ForgotPasswordPost\Interceptor->___callPlugins('execute', Array, Array)
#19 /path_to_magento/magento2/vendor/magento/framework/App/Action/Action.php(107): Magento\Customer\Controller\Account\ForgotPasswordPost\Interceptor->execute()
#20 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#21 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Customer\Controller\Account\ForgotPasswordPost\Interceptor->___callParent('dispatch', Array)
#22 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Customer\Controller\Account\ForgotPasswordPost\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#23 /path_to_magento/magento2/generated/code/Magento/Customer/Controller/Account/ForgotPasswordPost/Interceptor.php(39): Magento\Customer\Controller\Account\ForgotPasswordPost\Interceptor->___callPlugins('dispatch', Array, Array)
#24 /path_to_magento/magento2/vendor/magento/framework/App/FrontController.php(55): Magento\Customer\Controller\Account\ForgotPasswordPost\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#25 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#26 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#27 /path_to_magento/magento2/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(94): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#28 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#29 /path_to_magento/magento2/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(73): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#30 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#31 /path_to_magento/magento2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#32 /path_to_magento/magento2/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, NULL)
#33 /path_to_magento/magento2/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#34 /path_to_magento/magento2/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()
#35 /path_to_magento/magento2/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()
#36 /path_to_magento/magento2/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#37 {main} [] []

Metadata

Metadata

Assignees

Labels

Component: CustomerFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions