Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Config.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Security\Model;
7 
10 use Magento\Store\Model\ScopeInterface as StoreScopeInterface;
11 
15 class Config implements ConfigInterface
16 {
20  const LIMITATION_TIME_PERIOD = 3600;
21 
25  const XML_PATH_ADMIN_AREA = 'admin/security/';
26 
30  const XML_PATH_FRONTEND_AREA = 'customer/password/';
31 
38 
42  const XML_PATH_ADMIN_ACCOUNT_SHARING = 'admin/security/admin_account_sharing';
43 
47  const XML_PATH_PASSWORD_RESET_PROTECTION_TYPE = 'password_reset_protection_type';
48 
52  const XML_PATH_MAX_NUMBER_PASSWORD_RESET_REQUESTS = 'max_number_password_reset_requests';
53 
57  const XML_PATH_MIN_TIME_BETWEEN_PASSWORD_RESET_REQUESTS = 'min_time_between_password_reset_requests';
58 
62  const XML_PATH_EMAIL_RECIPIENT = 'contact/email/recipient_email';
63 
67  private $scopeConfig;
68 
72  private $scope;
73 
80  public function __construct(
81  ScopeConfigInterface $scopeConfig,
82  ScopeInterface $scope
83  ) {
84  $this->scopeConfig = $scopeConfig;
85  $this->scope = $scope;
86  }
87 
93  public function getCustomerServiceEmail()
94  {
95  return $this->scopeConfig->getValue(
96  self::XML_PATH_EMAIL_RECIPIENT,
97  StoreScopeInterface::SCOPE_STORE
98  );
99  }
100 
106  public function getLimitationTimePeriod()
107  {
109  }
110 
117  {
118  return $this->scopeConfig->isSetFlag(
119  self::XML_PATH_ADMIN_ACCOUNT_SHARING,
120  StoreScopeInterface::SCOPE_STORE
121  );
122  }
123 
129  public function getAdminSessionLifetime()
130  {
131  return (int) $this->scopeConfig->getValue(\Magento\Backend\Model\Auth\Session::XML_PATH_SESSION_LIFETIME);
132  }
133 
139  protected function getXmlPathPrefix()
140  {
141  if ($this->scope->getCurrentScope() == \Magento\Framework\App\Area::AREA_ADMINHTML) {
143  }
145  }
146 
153  {
154  return (int) $this->scopeConfig->getValue(
155  $this->getXmlPathPrefix() . self::XML_PATH_PASSWORD_RESET_PROTECTION_TYPE,
156  StoreScopeInterface::SCOPE_STORE
157  );
158  }
159 
167  {
168  return (int) $this->scopeConfig->getValue(
169  $this->getXmlPathPrefix() . self::XML_PATH_MAX_NUMBER_PASSWORD_RESET_REQUESTS,
170  StoreScopeInterface::SCOPE_STORE
171  );
172  }
173 
181  {
182  $timeInMin = $this->scopeConfig->getValue(
183  $this->getXmlPathPrefix() . self::XML_PATH_MIN_TIME_BETWEEN_PASSWORD_RESET_REQUESTS,
184  StoreScopeInterface::SCOPE_STORE
185  );
186  return $timeInMin * 60;
187  }
188 }
__construct(ScopeConfigInterface $scopeConfig, ScopeInterface $scope)
Definition: Config.php:80
const XML_PATH_PASSWORD_RESET_PROTECTION_TYPE
Definition: Config.php:47
const XML_PATH_MAX_NUMBER_PASSWORD_RESET_REQUESTS
Definition: Config.php:52
const XML_PATH_MIN_TIME_BETWEEN_PASSWORD_RESET_REQUESTS
Definition: Config.php:57