function user_login_form

Form builder; the main user login form.

Related topics

2 string references to 'user_login_form'
UserLoginBlock::build in drupal/core/modules/user/lib/Drupal/user/Plugin/Block/UserLoginBlock.php
Builds and returns the renderable array for this block plugin.
user_page in drupal/core/modules/user/user.pages.inc
Access callback for path /user.

File

drupal/core/modules/user/user.module, line 1166
Enables the user registration and login system.

Code

function user_login_form($form, &$form_state) {

  // Display login form:
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Username'),
    '#size' => 60,
    '#maxlength' => USERNAME_MAX_LENGTH,
    '#description' => t('Enter your @s username.', array(
      '@s' => config('system.site')
        ->get('name'),
    )),
    '#required' => TRUE,
    '#attributes' => array(
      'autocorrect' => 'off',
      'autocapitalize' => 'off',
      'spellcheck' => 'false',
      'autofocus' => 'autofocus',
    ),
  );
  $form['pass'] = array(
    '#type' => 'password',
    '#title' => t('Password'),
    '#size' => 60,
    '#description' => t('Enter the password that accompanies your username.'),
    '#required' => TRUE,
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Log in'),
  );
  $form['#validate'] = user_login_default_validators();
  return $form;
}