session = $session; $this->accountRedirect = $accountRedirect; $this->customerRegistry = $customerRegistry; $this->encryptor = $encryptor; $this->customerLinkManagement = $customerLinkManagement; } public function execute() { $credentials = $this->session->getValidationCredentials(); if (null !== $credentials && $credentials instanceof ValidationCredentials) { $password = $this->getRequest()->getParam('password'); $hash = $this->customerRegistry->retrieveSecureData($credentials->getCustomerId())->getPasswordHash(); if ($this->encryptor->validateHash($password, $hash)) { $this->customerLinkManagement->updateLink($credentials->getCustomerId(), $credentials->getAmazonId()); $this->session->loginById($credentials->getCustomerId()); } else { $this->messageManager->addErrorMessage('The password supplied was incorrect'); return $this->_redirect($this->_url->getRouteUrl('*/*/validate')); } } return $this->accountRedirect->getRedirect(); } }