Skip to main content

How reorder verifies guest and logged in user

When customer or guest uses "reorder" Magento2 somehow verifies, that user have access to order details (either logged in person owns order or guest verified that it is his order through /sales/guest/form/). I am trying to use the same mechanism to verify if user can return order, but I can't find out how Magento2 verifies the user. Does anyone know? So far I have tried:

  1. $this->_customerSession->authenticate($loginUrl) [doesn't work at all with guest and doesn't verify if logged in user owns the order]
  2. $this->_formKeyValidator->validate($this->getRequest()) [checks only if form was created by Magento and doesn't verify if user owns the order]

Thank you in advance for any hints!

PatrykD
  • 57
  • 1
  • 10