/** * Checks if 'synonyms' feature is supported by configured search engine. If not supported displays a notice * * @return void */ protected function checkSearchEngineSupport() { // Display a notice if search engine configuration does not support synonyms $searchEngine = $this->engineResolver->getCurrentSearchEngine(); if (!$this->searchFeatureConfig->isFeatureSupported(\Magento\Framework\Search\SearchEngine\ConfigInterface::SEARCH_ENGINE_FEATURE_SYNONYMS, $searchEngine)) { $this->messageManager->addNoticeMessage(__('Search synonyms are not supported by the %1 search engine. ' . 'Any synonyms you enter won\'t be used.', $searchEngine)); } }
/** * Execute method. */ public function execute() { $result = ['errors' => false, 'message' => '']; $website = $this->getRequest()->getParam('website', 0); $client = false; if ($this->data->isEnabled()) { $client = $this->data->getWebsiteApiClient($website); } $redirectUrl = $this->getUrl('adminhtml/system_config/edit', ['section' => 'connector_developer_settings']); if (!$client) { $this->messageManager->addNoticeMessage('Please enable api first.'); } else { // get all possible datatifileds $datafields = $this->datafield->getContactDatafields(); foreach ($datafields as $key => $datafield) { $response = $client->postDataFields($datafield); //ignore existing datafields message if (isset($response->message) && $response->message != \Dotdigitalgroup\Email\Model\Apiconnector\Client::API_ERROR_DATAFIELD_EXISTS) { $result['errors'] = true; $result['message'] .= ' Datafield ' . $datafield['name'] . ' - ' . $response->message . '</br>'; } else { if ($website) { $scope = 'websites'; $scopeId = $website; } else { $scope = 'default'; $scopeId = '0'; } /* * map the succesful created datafield */ $this->data->saveConfigData('connector_data_mapping/customer_data/' . $key, strtoupper($datafield['name']), $scope, $scopeId); $this->data->log('successfully connected : ' . $datafield['name']); } } if ($result['errors']) { $this->messageManager->addNoticeMessage($result['message']); } else { $this->messageManager->addSuccessMessage('All Datafields Created And Mapped.'); } } $this->_redirect($redirectUrl); }
/** * Generate new token and connect from the admin. * * @return string */ public function generatetokenAction() { $adminUser = $this->auth->getUser(); $refreshToken = $adminUser->getRefreshToken(); if ($refreshToken) { $token = $this->client->getAccessToken($this->buildUrlParams($refreshToken), $this->configFactory->getTokenUrl()); //save the refresh token to the admin user if (is_string($token)) { $adminUser->setRefreshToken($token)->save(); } return $token; } else { $this->messageManager->addNoticeMessage('Please Connect To Access The Page.'); } }
/** * Check whether the latest password is expired * Side-effect can be when passwords were changed with different lifetime configuration settings * * @param array $latestPassword * @return void */ private function _checkExpiredPassword($latestPassword) { if ($latestPassword && $this->observerConfig->_isLatestPasswordExpired($latestPassword)) { if ($this->observerConfig->isPasswordChangeForced()) { $message = __('It\'s time to change your password.'); } else { $myAccountUrl = $this->url->getUrl('adminhtml/system_account/'); $message = __('It\'s time to <a href="%1">change your password</a>.', $myAccountUrl); } $this->messageManager->addNoticeMessage($message); $message = $this->messageManager->getMessages()->getLastAddedMessage(); if ($message) { $message->setIdentifier('magento_user_password_expired')->setIsSticky(true); $this->authSession->setPciAdminUserIsPasswordExpired(true); } } }