Exemplo n.º 1
0
 /**
  * Retrieve feed url
  *
  * @return string
  */
 public function getFeedUrl()
 {
     $httpPath = $this->_backendConfig->isSetFlag(self::XML_USE_HTTPS_PATH) ? 'https://' : 'http://';
     if (is_null($this->_feedUrl)) {
         $this->_feedUrl = $httpPath . $this->_backendConfig->getValue(self::XML_FEED_URL_PATH);
     }
     return $this->_feedUrl;
 }
Exemplo n.º 2
0
    /**
     * Authenticate user name and password and save loaded record
     *
     * @param string $username
     * @param string $password
     * @return bool
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    public function authenticate($username, $password)
    {
        $config = $this->_config->isSetFlag('admin/security/use_case_sensitive_login');
        $result = false;

        try {
            $this->_eventManager->dispatch(
                'admin_user_authenticate_before',
                ['username' => $username, 'user' => $this]
            );
            $this->loadByUsername($username);
            $sensitive = $config ? $username == $this->getUsername() : true;
            if ($sensitive && $this->getId()) {
                $result = $this->verifyIdentity($password);
            }

            $this->_eventManager->dispatch(
                'admin_user_authenticate_after',
                ['username' => $username, 'password' => $password, 'user' => $this, 'result' => $result]
            );
        } catch (\Magento\Framework\Exception\LocalizedException $e) {
            $this->unsetData();
            throw $e;
        }

        if (!$result) {
            $this->unsetData();
        }
        return $result;
    }
 /**
  * Returns URL to controller action which returns new captcha image
  *
  * @return string
  */
 public function getRefreshUrl()
 {
     return $this->_url->getUrl('adminhtml/refresh/refresh', ['_secure' => $this->_config->isSetFlag('web/secure/use_in_adminhtml'), '_nosecret' => true]);
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function isActive($scope = null)
 {
     return $this->config->isSetFlag('dev/translate_inline/active_admin');
 }
 /**
  * {@inheritdoc}
  *
  * @param string $path
  * @return bool
  */
 public function shouldBeSecure($path)
 {
     return parse_url((string) $this->coreConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, 'default'), PHP_URL_SCHEME) === 'https' || $this->backendConfig->isSetFlag(Store::XML_PATH_SECURE_IN_ADMINHTML) && parse_url((string) $this->coreConfig->getValue(Store::XML_PATH_SECURE_BASE_URL, 'default'), PHP_URL_SCHEME) === 'https';
 }
Exemplo n.º 6
0
 /**
  * Check whether URL for corresponding path should use https protocol
  *
  * @param string $path
  * @return bool
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 protected function _shouldBeSecure($path)
 {
     return substr((string) $this->_coreConfig->getValue('web/unsecure/base_url', 'default'), 0, 5) === 'https' || $this->_backendConfig->isSetFlag('web/secure/use_in_adminhtml') && substr((string) $this->_coreConfig->getValue('web/secure/base_url', 'default'), 0, 5) === 'https';
 }
Exemplo n.º 7
0
 /**
  * Authenticate user name and password and save loaded record
  *
  * @param string $username
  * @param string $password
  * @return bool
  * @throws \Magento\Framework\Model\Exception
  * @throws \Magento\Backend\Model\Auth\Exception
  * @throws \Magento\Backend\Model\Auth\Plugin\Exception
  */
 public function authenticate($username, $password)
 {
     $config = $this->_config->isSetFlag('admin/security/use_case_sensitive_login');
     $result = false;
     try {
         $this->_eventManager->dispatch('admin_user_authenticate_before', array('username' => $username, 'user' => $this));
         $this->loadByUsername($username);
         $sensitive = $config ? $username == $this->getUsername() : true;
         if ($sensitive && $this->getId() && $this->_encryptor->validateHash($password, $this->getPassword())) {
             if ($this->getIsActive() != '1') {
                 throw new \Magento\Backend\Model\Auth\Exception(__('This account is inactive.'));
             }
             if (!$this->hasAssigned2Role($this->getId())) {
                 throw new \Magento\Backend\Model\Auth\Exception(__('Access denied.'));
             }
             $result = true;
         }
         $this->_eventManager->dispatch('admin_user_authenticate_after', array('username' => $username, 'password' => $password, 'user' => $this, 'result' => $result));
     } catch (\Magento\Framework\Model\Exception $e) {
         $this->unsetData();
         throw $e;
     }
     if (!$result) {
         $this->unsetData();
     }
     return $result;
 }