diff --git a/src/AccessChecks/ResetPassAccessCheck.php b/src/AccessChecks/ResetPassAccessCheck.php
index 4181cec..db52fd8 100644
--- a/src/AccessChecks/ResetPassAccessCheck.php
+++ b/src/AccessChecks/ResetPassAccessCheck.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\simple_pass_reset\AccessChecks;
 
+use Drupal\Core\Url;
 use Drupal\Core\Routing\Access\AccessInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Access\AccessResult;
@@ -33,24 +34,24 @@ class ResetPassAccessCheck implements AccessInterface {
     if ($account->isAuthenticated()) {
       // A different user is already logged in on the computer.
       if ($account->id() != $uid) {
-        drupal_set_message(t('Another user (%other_user) is already logged into the site on this computer, but you tried to use a one-time link for user %resetting_user. Please <a href=":logout">log out</a> and try using the link again.',
+        \Drupal::messenger()->addWarning(t('Another user (%other_user) is already logged into the site on this computer, but you tried to use a one-time link for user %resetting_user. Please <a href=":logout">log out</a> and try using the link again.',
           [
             '%other_user' => $account->getUsername(),
             '%resetting_user' => $user->getUsername(),
-            ':logout' => \Drupal::url('user.logout'),
-          ]), 'warning');
+            ':logout' => Url::fromRoute('user.logout')->toString(),
+          ]));
         // Throw access denied page.
         return AccessResult::forbidden();
       }
     }
 
-    if ($timestamp <= REQUEST_TIME && $user) {
+    if ($timestamp <= \Drupal::time()->getRequestTime() && $user) {
       // Bypass the timeout check if the user has not logged in before.
-      if ($user->getLastLoginTime() && REQUEST_TIME - $timestamp > $timeout) {
-        drupal_set_message(t('You have tried to use a one-time login link that has expired. Please request a new one using the <a href=":link">link</a>.', [':link' => \Drupal::url('user.pass')]), 'error');
+      if ($user->getLastLoginTime() && \Drupal::time()->getRequestTime() - $timestamp > $timeout) {
+        \Drupal::messenger()->addError(t('You have tried to use a one-time login link that has expired. Please request a new one using the <a href=":link">link</a>.', [':link' => Url::fromRoute('user.pass')->toString()]));
         return AccessResult::forbidden();
       }
-      elseif (($timestamp >= $user->getLastLoginTime()) && ($timestamp <= REQUEST_TIME) && Crypt::hashEquals($hash, user_pass_rehash($user, $timestamp))) {
+      elseif (($timestamp >= $user->getLastLoginTime()) && ($timestamp <= \Drupal::time()->getRequestTime()) && Crypt::hashEquals($hash, user_pass_rehash($user, $timestamp))) {
         return AccessResult::Allowed();
       }
     }
diff --git a/src/Controller/User.php b/src/Controller/User.php
index 4509c86..b80c415 100644
--- a/src/Controller/User.php
+++ b/src/Controller/User.php
@@ -29,7 +29,7 @@ class User extends ControllerBase {
         'hash' => $hash,
       ]);
     }
-    $formObject = \Drupal::entityManager()
+    $formObject = \Drupal::service('entity_type.manager')
       ->getFormObject('user', 'default')
       ->setEntity($user);
     return $this->formBuilder()->getForm($formObject);
