function user_login
7.x user.module | user_login( |
6.x user.module | user_login(&$form_state) |
Form builder; the main user login form.
Related topics
7 string references to 'user_login'
- hook_page_alter in drupal-7.x/
modules/ system/ system.api.php - Perform alterations before a page is rendered.
- TriggerOtherTestCase::testActionsUser in drupal-7.x/
modules/ trigger/ trigger.test - Tests triggering on user create and user login.
- TriggerUserTokenTestCase::testUserTriggerTokenReplacement in drupal-7.x/
modules/ trigger/ trigger.test - Tests a variety of token replacements in actions.
- trigger_test_action_info in drupal-7.x/
modules/ trigger/ tests/ trigger_test.module - Implements hook_action_info().
- trigger_trigger_info in drupal-7.x/
modules/ trigger/ trigger.module - Implements hook_trigger_info().
File
- drupal-7.x/
modules/ user/ user.module, line 2071 - Enables the user registration and login system.
Code
function user_login($form, &$form_state) {
global $user;
// If we are already logged on, go to the user page instead.
if ($user->uid) {
drupal_goto('user/' . $user->uid);
}
// Display login form:
$form['name'] = array('#type' => 'textfield',
'#title' => t('Username'),
'#size' => 60,
'#maxlength' => USERNAME_MAX_LENGTH,
'#required' => TRUE,
);
$form['name']['#description'] = t('Enter your @s username.', array('@s' => variable_get('site_name', 'Drupal')));
$form['pass'] = array('#type' => 'password',
'#title' => t('Password'),
'#description' => t('Enter the password that accompanies your username.'),
'#required' => TRUE,
);
$form['#validate'] = user_login_default_validators();
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Log in'));
return $form;
}