diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index b7ac23d..68244a5 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -806,14 +806,6 @@ function user_block_view($delta = '') {
     case 'login':
       // For usability's sake, avoid showing two login forms on one page.
       if (!$user->uid && !(arg(0) == 'user' && !is_numeric(arg(1)))) {
-        // Customize the login form.
-        $form = drupal_get_form('user_login_form');
-        unset($form['name']['#attributes']['autofocus']);
-        unset($form['name']['#description']);
-        unset($form['pass']['#description']);
-        $form['name']['#size'] = 15;
-        $form['pass']['#size'] = 15;
-        $form['#action'] = url(current_path(), array('query' => drupal_get_destination(), 'external' => FALSE));
         // Build action links.
         $items = array();
         if (config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY) {
@@ -833,7 +825,7 @@ function user_block_view($delta = '') {
         // Build a block as renderable array.
         $block['subject'] = t('User login');
         $block['content'] = array(
-          'user_login_form' => $form,
+          'user_login_form' => drupal_get_form('user_login_form_block'),
           'user_links' => array(
             '#theme' => 'item_list',
             '#items' => $items,
@@ -1568,6 +1560,30 @@ function user_set_authmaps($account, $authmaps) {
 }
 
 /**
+ * Implements hook_forms().
+ */
+function user_forms() {
+  $forms['user_login_form_block'] = array(
+    'callback' => 'user_login_form',
+  );
+  return $forms;
+}
+
+/**
+ * Implement hook_form_alter().
+ */
+function user_form_user_login_form_block_alter(&$form, &$form_state, $form_id) {
+  if ($form_id == 'user_login_form_block') {
+    unset($form['name']['#attributes']['autofocus']);
+    unset($form['name']['#description']);
+    unset($form['pass']['#description']);
+    $form['name']['#size'] = 15;
+    $form['pass']['#size'] = 15;
+    $form['#action'] = url(current_path(), array('query' => drupal_get_destination(), 'external' => FALSE));
+  }
+}
+
+/**
  * Form builder; the main user login form.
  *
  * @ingroup forms
