diff --git a/core/modules/user/src/Controller/UserController.php b/core/modules/user/src/Controller/UserController.php
index 0eb2729..74d59da 100644
--- a/core/modules/user/src/Controller/UserController.php
+++ b/core/modules/user/src/Controller/UserController.php
@@ -6,10 +6,13 @@
 use Drupal\Component\Utility\Xss;
 use Drupal\Core\Controller\ControllerBase;
 use Drupal\Core\Datetime\DateFormatterInterface;
+use Drupal\user\Form\UserPasswordResetForm;
 use Drupal\user\UserDataInterface;
 use Drupal\user\UserInterface;
 use Drupal\user\UserStorageInterface;
+use Psr\Log\LoggerInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
 
 /**
@@ -39,6 +42,13 @@ class UserController extends ControllerBase {
   protected $userData;
 
   /**
+   * A logger instance.
+   *
+   * @var \Psr\Log\LoggerInterface
+   */
+  protected $logger;
+
+  /**
    * Constructs a UserController object.
    *
    * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
@@ -47,11 +57,14 @@ class UserController extends ControllerBase {
    *   The user storage.
    * @param \Drupal\user\UserDataInterface $user_data
    *   The user data service.
+   * @param \Psr\Log\LoggerInterface $logger
+   *   A logger instance.
    */
-  public function __construct(DateFormatterInterface $date_formatter, UserStorageInterface $user_storage, UserDataInterface $user_data) {
+  public function __construct(DateFormatterInterface $date_formatter, UserStorageInterface $user_storage, UserDataInterface $user_data, LoggerInterface $logger) {
     $this->dateFormatter = $date_formatter;
     $this->userStorage = $user_storage;
     $this->userData = $user_data;
+    $this->logger = $logger;
   }
 
   /**
@@ -61,76 +74,190 @@ public static function create(ContainerInterface $container) {
     return new static(
       $container->get('date.formatter'),
       $container->get('entity.manager')->getStorage('user'),
-      $container->get('user.data')
+      $container->get('user.data'),
+      $container->get('logger.factory')->get('user')
     );
   }
 
   /**
-   * Returns the user password reset page.
+   * Redirects to the user password reset page.
    *
+   * @deprecated in Drupal 8.x, will be removed before Drupal 9.0.
+   *   Use \Drupal\user\UserController::resetPassRedirect().
+   */
+  public function resetPass($uid, $timestamp, $hash) {
+    return $this->redirect(
+      'user.reset',
+      [
+        'uid' => $uid,
+        'timestamp' => $timestamp,
+        'hash' => $hash
+      ]
+    );
+  }
+
+  /**
+   * Redirects to the user password reset form.
+   *
+   * In order to never disclose a redirect link via a referrer header this
+   * controller must always return a redirect response.
+   *
+   * @param \Symfony\Component\HttpFoundation\Request $request
+   *   The request.
    * @param int $uid
-   *   UID of user requesting reset.
+   *   User ID of the user requesting reset.
    * @param int $timestamp
    *   The current timestamp.
    * @param string $hash
    *   Login link hash.
    *
-   * @return array|\Symfony\Component\HttpFoundation\RedirectResponse
-   *   The form structure or a redirect response.
+   * @return \Symfony\Component\HttpFoundation\RedirectResponse
+   *   The redirect response.
    *
    * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
    *   If the login link is for a blocked user or invalid user ID.
    */
-  public function resetPass($uid, $timestamp, $hash) {
+  public function resetPassRedirect(Request $request, $uid, $timestamp, $hash) {
+    $reset_link_user = $this->userStorage->load($uid);
+    if ($reset_link_user === NULL || !$reset_link_user->isActive()) {
+      // Blocked or invalid user ID, so deny access. The parameters will be in the
+      // watchdog's URL for the administrator to check.
+      throw new AccessDeniedHttpException();
+    }
+
     $account = $this->currentUser();
-    $config = $this->config('user.settings');
     // When processing the one-time login link, we have to make sure that a user
     // isn't already logged in.
     if ($account->isAuthenticated()) {
       // The current user is already logged in.
       if ($account->id() == $uid) {
         user_logout();
+        // We need to begin the redirect process again because logging out will
+        // destroy the session.
+        return $this->redirect(
+          'user.reset',
+          [
+            'uid' => $uid,
+            'timestamp' => $timestamp,
+            'hash' => $hash,
+          ]
+        );
       }
       // A different user is already logged in on the computer.
       else {
-        if ($reset_link_user = $this->userStorage->load($uid)) {
-          drupal_set_message($this->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.',
-            array('%other_user' => $account->getUsername(), '%resetting_user' => $reset_link_user->getUsername(), ':logout' => $this->url('user.logout'))), 'warning');
-        }
-        else {
-          // Invalid one-time link specifies an unknown user.
-          drupal_set_message($this->t('The one-time login link you clicked is invalid.'), 'error');
-        }
+        drupal_set_message($this->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.',
+          array('%other_user' => $account->getUsername(), '%resetting_user' => $reset_link_user->getUsername(), ':logout' => $this->url('user.logout'))), 'warning');
+
         return $this->redirect('<front>');
       }
     }
-    // The current user is not logged in, so check the parameters.
+
+    $session = $request->getSession();
+    $session->set('pass_reset_hash', $hash);
+    $session->set('pass_reset_timeout', $timestamp);
+    return $this->redirect(
+      'user.reset.form',
+      ['uid' => $uid]
+    );
+  }
+
+  /**
+   * Returns the user password reset page.
+   *
+   * @param int $uid
+   *   User ID of the user requesting reset.
+   * @param \Symfony\Component\HttpFoundation\Request $request
+   *   The request.
+   *
+   * @return array|\Symfony\Component\HttpFoundation\RedirectResponse
+   *   The form structure or a redirect response.
+   *
+   * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
+   *   If the pass_reset_timeout or pass_reset_hash are not available in the
+   *   session. Or if $uid is for a blocked user or invalid user ID.
+   */
+  public function getResetPassForm($uid, Request $request) {
+    $session = $request->getSession();
+    $timestamp = $session->get('pass_reset_timeout');
+    $hash = $session->get('pass_reset_hash');
+    // As soon as the session variables are used they are removed to prevent the
+    // hash and timestamp from being leaked unexpectedly. This could occur if
+    // the user does not click on the log in button on the form.
+    $session->remove('pass_reset_timeout');
+    $session->remove('pass_reset_hash');
+
+    /** @var \Drupal\user\UserInterface $user */
+    $user = $this->userStorage->load($uid);
+
+    if (!$hash || !$timestamp || $user === NULL || !$user->isActive()) {
+      throw new AccessDeniedHttpException();
+    }
+
     // Time out, in seconds, until login URL expires.
-    $timeout = $config->get('password_reset_timeout');
-    $current = REQUEST_TIME;
+    $timeout = $this->config('user.settings')->get('password_reset_timeout');
 
-    /* @var \Drupal\user\UserInterface $user */
+    $expiration_date = $user->getLastLoginTime() ? $this->dateFormatter->format($timestamp + $timeout) : NULL;
+    return $this->formBuilder()->getForm(UserPasswordResetForm::class, $user, $expiration_date, $timestamp, $hash);
+  }
+
+  /**
+   * Validates user, hash and timestamp and logs the user in if correct.
+   *
+   * @param int $uid
+   *   User ID of the user requesting reset.
+   * @param int $timestamp
+   *   The current timestamp.
+   * @param string $hash
+   *   Login link hash.
+   *
+   * @return \Symfony\Component\HttpFoundation\RedirectResponse
+   *   Returns a redirect to the user edit form if the information is correct.
+   *   If the information is incorrect redirects to 'user.pass' route with a
+   *   message for the user.
+   *
+   * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
+   *   If $uid is for a blocked user or invalid user ID.
+   */
+  public function resetPassLogin($uid, $timestamp, $hash) {
+    // The current user is not logged in, so check the parameters.
+    $current = REQUEST_TIME;
+    /** @var \Drupal\user\UserInterface $user */
     $user = $this->userStorage->load($uid);
 
     // Verify that the user exists and is active.
-    if ($user && $user->isActive()) {
-      // No time out for first time login.
-      if ($user->getLastLoginTime() && $current - $timestamp > $timeout) {
-        drupal_set_message($this->t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'), 'error');
-        return $this->redirect('user.pass');
-      }
-      elseif ($user->isAuthenticated() && ($timestamp >= $user->getLastLoginTime()) && ($timestamp <= $current) && Crypt::hashEquals($hash, user_pass_rehash($user, $timestamp))) {
-        $expiration_date = $user->getLastLoginTime() ? $this->dateFormatter->format($timestamp + $timeout) : NULL;
-        return $this->formBuilder()->getForm('Drupal\user\Form\UserPasswordResetForm', $user, $expiration_date, $timestamp, $hash);
-      }
-      else {
-        drupal_set_message($this->t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'), 'error');
-        return $this->redirect('user.pass');
-      }
+    if ($user === NULL && !$user->isActive()) {
+      // Blocked or invalid user ID, so deny access. The parameters will be in the
+      // watchdog's URL for the administrator to check.
+      throw new AccessDeniedHttpException();
     }
-    // Blocked or invalid user ID, so deny access. The parameters will be in the
-    // watchdog's URL for the administrator to check.
-    throw new AccessDeniedHttpException();
+
+    // Time out, in seconds, until login URL expires.
+    $timeout = $this->config('user.settings')->get('password_reset_timeout');
+    // No time out for first time login.
+    if ($user->getLastLoginTime() && $current - $timestamp > $timeout) {
+      drupal_set_message($this->t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'), 'error');
+      return $this->redirect('user.pass');
+    }
+    elseif ($user->isAuthenticated() && ($timestamp >= $user->getLastLoginTime()) && ($timestamp <= $current) && Crypt::hashEquals($hash, user_pass_rehash($user, $timestamp))) {
+      user_login_finalize($user);
+      $this->logger->notice('User %name used one-time login link at time %timestamp.', ['%name' => $user->getDisplayName(), '%timestamp' => $timestamp]);
+      drupal_set_message($this->t('You have just used your one-time login link. It is no longer necessary to use this link to log in. Please change your password.'));
+      // Let the user's password be changed without the current password
+      // check.
+      $token = Crypt::randomBytesBase64(55);
+      $_SESSION['pass_reset_' . $user->id()] = $token;
+      return $this->redirect(
+        'entity.user.edit_form',
+        ['user' => $user->id()],
+        [
+          'query' => ['pass-reset-token' => $token],
+          'absolute' => TRUE,
+        ]
+      );
+    }
+
+    drupal_set_message($this->t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'), 'error');
+    return $this->redirect('user.pass');
   }
 
   /**
diff --git a/core/modules/user/src/Form/UserPasswordResetForm.php b/core/modules/user/src/Form/UserPasswordResetForm.php
index 432941a..60e23bd 100644
--- a/core/modules/user/src/Form/UserPasswordResetForm.php
+++ b/core/modules/user/src/Form/UserPasswordResetForm.php
@@ -4,10 +4,8 @@
 
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Session\AccountInterface;
-use Drupal\Component\Utility\Crypt;
 use Drupal\Core\Form\FormBase;
-use Psr\Log\LoggerInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\Core\Url;
 
 /**
  * Form controller for the user password forms.
@@ -15,32 +13,6 @@
 class UserPasswordResetForm extends FormBase {
 
   /**
-   * A logger instance.
-   *
-   * @var \Psr\Log\LoggerInterface
-   */
-  protected $logger;
-
-  /**
-   * Constructs a new UserPasswordResetForm.
-   *
-   * @param \Psr\Log\LoggerInterface $logger
-   *   A logger instance.
-   */
-  public function __construct(LoggerInterface $logger) {
-    $this->logger = $logger;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('logger.factory')->get('user')
-    );
-  }
-
-  /**
    * {@inheritdoc}
    */
   public function getFormId() {
@@ -75,20 +47,17 @@ public function buildForm(array $form, FormStateInterface $form_state, AccountIn
       $form['#title'] = $this->t('Set password');
     }
 
-    $form['user'] = array(
-      '#type' => 'value',
-      '#value' => $user,
-    );
-    $form['timestamp'] = array(
-      '#type' => 'value',
-      '#value' => $timestamp,
-    );
     $form['help'] = array('#markup' => '<p>' . $this->t('This login can be used only once.') . '</p>');
     $form['actions'] = array('#type' => 'actions');
     $form['actions']['submit'] = array(
       '#type' => 'submit',
       '#value' => $this->t('Log in'),
     );
+    $form['#action'] = Url::fromRoute('user.reset.login', [
+      'uid' => $user->id(),
+      'timestamp' => $timestamp,
+      'hash' => $hash
+    ])->toString();
     return $form;
   }
 
@@ -96,22 +65,8 @@ public function buildForm(array $form, FormStateInterface $form_state, AccountIn
    * {@inheritdoc}
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
-    /** @var $user \Drupal\user\UserInterface */
-    $user = $form_state->getValue('user');
-    user_login_finalize($user);
-    $this->logger->notice('User %name used one-time login link at time %timestamp.', array('%name' => $user->getUsername(), '%timestamp' => $form_state->getValue('timestamp')));
-    drupal_set_message($this->t('You have just used your one-time login link. It is no longer necessary to use this link to log in. Please change your password.'));
-    // Let the user's password be changed without the current password check.
-    $token = Crypt::randomBytesBase64(55);
-    $_SESSION['pass_reset_' . $user->id()] = $token;
-    $form_state->setRedirect(
-      'entity.user.edit_form',
-      array('user' => $user->id()),
-      array(
-        'query' => array('pass-reset-token' => $token),
-        'absolute' => TRUE,
-      )
-    );
+    // This form works by submitting the hash and timestamp to the user.reset
+    // route with a 'login' action.
   }
 
 }
diff --git a/core/modules/user/src/Tests/UserPasswordResetTest.php b/core/modules/user/src/Tests/UserPasswordResetTest.php
index 0fa89e5..979be75 100644
--- a/core/modules/user/src/Tests/UserPasswordResetTest.php
+++ b/core/modules/user/src/Tests/UserPasswordResetTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\user\Tests;
 
+use Drupal\Core\Url;
 use Drupal\system\Tests\Cache\PageCacheTagsTestBase;
 use Drupal\user\Entity\User;
 
@@ -68,6 +69,11 @@ protected function setUp() {
    * Tests password reset functionality.
    */
   function testUserPasswordReset() {
+    // Verify that accessing the password reset form without having the session
+    // variables set results in an access denied message.
+    $this->drupalGet(Url::fromRoute('user.reset.form', ['uid' => $this->account->id()]));
+    $this->assertResponse(403);
+
     // Try to reset the password for an invalid account.
     $this->drupalGet('user/password');
 
@@ -88,6 +94,9 @@ function testUserPasswordReset() {
 
     $resetURL = $this->getResetURL();
     $this->drupalGet($resetURL);
+    // Ensure that the current url does not contain the hash and timestamp.
+    $this->assertUrl(Url::fromRoute('user.reset.form', ['uid' => $this->account->id()]));
+
     $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'));
 
     // Ensure the password reset URL is not cached.
@@ -125,6 +134,7 @@ function testUserPasswordReset() {
     // Log out, and try to log in again using the same one-time link.
     $this->drupalLogout();
     $this->drupalGet($resetURL);
+    $this->drupalPostForm(NULL, NULL, t('Log in'));
     $this->assertText(t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'), 'One-time link is no longer valid.');
 
     // Request a new password again, this time using the email address.
@@ -149,6 +159,7 @@ function testUserPasswordReset() {
     $bogus_timestamp = REQUEST_TIME - $timeout - 60;
     $_uid = $this->account->id();
     $this->drupalGet("user/reset/$_uid/$bogus_timestamp/" . user_pass_rehash($this->account, $bogus_timestamp));
+    $this->drupalPostForm(NULL, NULL, t('Log in'));
     $this->assertText(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'), 'Expired password reset request rejected.');
 
     // Create a user, block the account, and verify that a login link is denied.
@@ -175,7 +186,18 @@ function testUserPasswordReset() {
     $this->account->setEmail("1" . $this->account->getEmail());
     $this->account->save();
     $this->drupalGet($old_email_reset_link);
+    $this->drupalPostForm(NULL, NULL, t('Log in'));
     $this->assertText(t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'), 'One-time link is no longer valid.');
+
+    // Verify a password reset link will automatically log a user when /login is
+    // appended.
+    $this->drupalGet('user/password');
+    $edit = array('name' => $this->account->getUsername());
+    $this->drupalPostForm(NULL, $edit, t('Submit'));
+    $reset_url = $this->getResetURL();
+    $this->drupalGet($reset_url . '/login');
+    $this->assertLink(t('Log out'));
+    $this->assertTitle(t('@name | @site', array('@name' => $this->account->getUsername(), '@site' => $this->config('system.site')->get('name'))), 'Logged in using password reset link.');
   }
 
   /**
@@ -265,6 +287,7 @@ function testResetImpersonation() {
     $reset_url = user_pass_reset_url($user1);
     $attack_reset_url = str_replace("user/reset/{$user1->id()}", "user/reset/{$user2->id()}", $reset_url);
     $this->drupalGet($attack_reset_url);
+    $this->drupalPostForm(NULL, NULL, t('Log in'));
     $this->assertNoText($user2->getUsername(), 'The invalid password reset page does not show the user name.');
     $this->assertUrl('user/password', array(), 'The user is redirected to the password reset request page.');
     $this->assertText('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.');
diff --git a/core/modules/user/user.routing.yml b/core/modules/user/user.routing.yml
index 6eea7ec..6589f21 100644
--- a/core/modules/user/user.routing.yml
+++ b/core/modules/user/user.routing.yml
@@ -140,13 +140,35 @@ user.cancel_confirm:
     _entity_access: 'user.delete'
     user: \d+
 
+user.reset.login:
+  path: '/user/reset/{uid}/{timestamp}/{hash}/login'
+  defaults:
+    _controller: '\Drupal\user\Controller\UserController::resetPassLogin'
+    _title: 'Reset password'
+  requirements:
+    _user_is_logged_in: 'FALSE'
+  options:
+    _maintenance_access: TRUE
+    no_cache: TRUE
+
 user.reset:
   path: '/user/reset/{uid}/{timestamp}/{hash}'
   defaults:
-    _controller: '\Drupal\user\Controller\UserController::resetPass'
+    _controller: '\Drupal\user\Controller\UserController::resetPassRedirect'
     _title: 'Reset password'
   requirements:
     _access: 'TRUE'
   options:
     _maintenance_access: TRUE
     no_cache: TRUE
+
+user.reset.form:
+  path: '/user/reset/{uid}'
+  defaults:
+    _controller: '\Drupal\user\Controller\UserController::getResetPassForm'
+    _title: 'Reset password'
+  requirements:
+    _user_is_logged_in: 'FALSE'
+  options:
+    _maintenance_access: TRUE
+    no_cache: TRUE
