Loading src/Plugin/Block/TfaUserLoginBlock.php +6 −6 Original line number Diff line number Diff line Loading @@ -24,11 +24,11 @@ use Symfony\Component\DependencyInjection\ContainerInterface; class TfaUserLoginBlock extends UserLoginBlock { /** * TFA configuration object. * The config factory. * * @var \Drupal\Core\Config\ImmutableConfig * @var \Drupal\Core\Config\ConfigFactoryInterface */ protected $tfaSettings; protected $configFactory; /** * Constructs a new UserLoginBlock instance. Loading @@ -49,7 +49,7 @@ class TfaUserLoginBlock extends UserLoginBlock { */ public function __construct(array $configuration, $plugin_id, $plugin_definition, RouteMatchInterface $route_match, ConfigFactoryInterface $config_factory) { parent::__construct($configuration, $plugin_id, $plugin_definition, $route_match); $this->tfaSettings = $config_factory->get('tfa.settings'); $this->configFactory = $config_factory; } /** Loading @@ -70,7 +70,7 @@ class TfaUserLoginBlock extends UserLoginBlock { */ protected function blockAccess(AccountInterface $account) { $access = parent::blockAccess($account); $tfaAccess = $this->tfaSettings->get('enabled'); $tfaAccess = $this->configFactory->get('tfa.settings')->get('enabled'); $route_name = $this->routeMatch->getRouteName(); $disabled_route = in_array($route_name, ['tfa.entry']); Loading Loading @@ -101,7 +101,7 @@ class TfaUserLoginBlock extends UserLoginBlock { ])->toString(); // Build action links. $items = []; if (\Drupal::config('user.settings')->get('register') != UserInterface::REGISTER_ADMINISTRATORS_ONLY) { if ($this->configFactory->get('user.settings')->get('register') != UserInterface::REGISTER_ADMINISTRATORS_ONLY) { $items['create_account'] = Link::fromTextAndUrl($this->t('Create new account'), new Url('user.register', [], [ 'attributes' => [ 'title' => $this->t('Create a new user account.'), Loading Loading
src/Plugin/Block/TfaUserLoginBlock.php +6 −6 Original line number Diff line number Diff line Loading @@ -24,11 +24,11 @@ use Symfony\Component\DependencyInjection\ContainerInterface; class TfaUserLoginBlock extends UserLoginBlock { /** * TFA configuration object. * The config factory. * * @var \Drupal\Core\Config\ImmutableConfig * @var \Drupal\Core\Config\ConfigFactoryInterface */ protected $tfaSettings; protected $configFactory; /** * Constructs a new UserLoginBlock instance. Loading @@ -49,7 +49,7 @@ class TfaUserLoginBlock extends UserLoginBlock { */ public function __construct(array $configuration, $plugin_id, $plugin_definition, RouteMatchInterface $route_match, ConfigFactoryInterface $config_factory) { parent::__construct($configuration, $plugin_id, $plugin_definition, $route_match); $this->tfaSettings = $config_factory->get('tfa.settings'); $this->configFactory = $config_factory; } /** Loading @@ -70,7 +70,7 @@ class TfaUserLoginBlock extends UserLoginBlock { */ protected function blockAccess(AccountInterface $account) { $access = parent::blockAccess($account); $tfaAccess = $this->tfaSettings->get('enabled'); $tfaAccess = $this->configFactory->get('tfa.settings')->get('enabled'); $route_name = $this->routeMatch->getRouteName(); $disabled_route = in_array($route_name, ['tfa.entry']); Loading Loading @@ -101,7 +101,7 @@ class TfaUserLoginBlock extends UserLoginBlock { ])->toString(); // Build action links. $items = []; if (\Drupal::config('user.settings')->get('register') != UserInterface::REGISTER_ADMINISTRATORS_ONLY) { if ($this->configFactory->get('user.settings')->get('register') != UserInterface::REGISTER_ADMINISTRATORS_ONLY) { $items['create_account'] = Link::fromTextAndUrl($this->t('Create new account'), new Url('user.register', [], [ 'attributes' => [ 'title' => $this->t('Create a new user account.'), Loading