diff --git a/src/GuardianManager.php b/src/GuardianManager.php
index df534c6..e811cd0 100644
--- a/src/GuardianManager.php
+++ b/src/GuardianManager.php
@@ -15,6 +15,7 @@ use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\user\UserInterface;
 use Egulias\EmailValidator\EmailValidator;
 use Symfony\Component\HttpFoundation\RequestStack;
+use Drupal\Core\Messenger\MessengerInterface;
 
 /**
  * Class GuardianManager.
@@ -89,6 +90,13 @@ final class GuardianManager implements GuardianManagerInterface {
   protected $moduleHandler;
 
   /**
+   * The messenger service
+   *
+   * @var \Drupal\Core\Messenger\MessengerInterface
+   */
+  protected $messenger;
+
+  /**
    * GuardianManager constructor.
    *
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
@@ -109,8 +117,10 @@ final class GuardianManager implements GuardianManagerInterface {
    *   The email validator.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler service.
+   * @param \Drupal\Core\Messenger\MessengerInterface $messenger
+   *   The messenger service.
    */
-  public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, MailManagerInterface $mail_manager, RequestStack $request_stack, AccountInterface $current_user, SessionManagerInterface $session_manager, TimeInterface $time, EmailValidator $email_validator, ModuleHandlerInterface $module_handler) {
+  public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, MailManagerInterface $mail_manager, RequestStack $request_stack, AccountInterface $current_user, SessionManagerInterface $session_manager, TimeInterface $time, EmailValidator $email_validator, ModuleHandlerInterface $module_handler, MessengerInterface $messenger) {
     $this->configFactory = $config_factory;
     $this->userStorage = $entity_type_manager->getStorage('user');
     $this->mailManager = $mail_manager;
@@ -120,6 +130,7 @@ final class GuardianManager implements GuardianManagerInterface {
     $this->time = $time;
     $this->emailValidator = $email_validator;
     $this->moduleHandler = $module_handler;
+    $this->messenger = $messenger;
   }
 
   /**
@@ -207,7 +218,7 @@ final class GuardianManager implements GuardianManagerInterface {
     $message = $this->formatPlural($hours,
       'Your last access was more than 1 hour ago, please login again.',
       'Your last access was more than @count hours ago, please login again.', ['@count' => $hours]);
-    drupal_set_message($message, 'warning', TRUE);
+    $this->messenger->addWarning($message, TRUE);
   }
 
   /**
