diff --git a/src/Form/SecureLoginConfigForm.php b/src/Form/SecureLoginConfigForm.php
index 2a83b38..f9cbbcb 100644
--- a/src/Form/SecureLoginConfigForm.php
+++ b/src/Form/SecureLoginConfigForm.php
@@ -9,6 +9,7 @@ namespace Drupal\securelogin\Form;
 
 use Drupal\Component\Utility\UrlHelper;
 use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -19,6 +20,32 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
 class SecureLoginConfigForm extends ConfigFormBase {
 
   /**
+   * The module handler.
+   *
+   * @var \Drupal\Core\Extension\ModuleHandlerInterface
+   */
+  protected $moduleHandler;
+
+  /**
+   * Creates a new SecureLoginConfigForm object.
+   *
+   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
+   *   The module handler.
+   */
+  public function __construct(ModuleHandlerInterface $module_handler) {
+    $this->moduleHandler = $module_handler;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container) {
+    return new static(
+      $container->get('module_handler')
+    );
+  }
+
+  /**
    * {@inheritdoc}.
    */
   public function getFormID() {
@@ -95,7 +122,7 @@ class SecureLoginConfigForm extends ConfigFormBase {
       '#default_value' => $conf->get('form_user_register_form'),
       '#description' => $this->config('user.settings')->get('verify_mail') ? '' : t('Must be checked to enforce secure authenticated sessions.'),
     );
-    \Drupal::moduleHandler()->alter('securelogin', $forms);
+    $this->moduleHandler->alter('securelogin', $forms);
     foreach ($forms as $id => $item) {
       $form['forms']["form_$id"] = array(
         '#type' => 'checkbox',
@@ -136,7 +163,7 @@ class SecureLoginConfigForm extends ConfigFormBase {
       ->save();
 
     $forms = array();
-    \Drupal::moduleHandler()->alter('securelogin', $forms);
+    $this->moduleHandler->alter('securelogin', $forms);
     foreach ($forms as $id => $item) {
       $this->config('securelogin.settings')->set("form_$id", $form_state->getValue("form_$id"))->save();
     }
