Same name and namespace in other branches
  1. 7.x modules/user/user.module \user_login_name_validate()

A FAPI validate handler. Sets an error if supplied username has been blocked or denied access.

1 call to user_login_name_validate()
user_external_login in modules/user/user.module
Perform standard Drupal login operations for a user object.
1 string reference to 'user_login_name_validate'
user_login_default_validators in modules/user/user.module
Set up a series for validators which check for blocked/denied users, then authenticate against local database, then return an error if authentication fails. Distributed authentication modules are welcome to use hook_form_alter() to change this series…

File

modules/user/user.module, line 1347
Enables the user registration and login system.

Code

function user_login_name_validate($form, &$form_state) {
  if (isset($form_state['values']['name'])) {
    if (user_is_blocked($form_state['values']['name'])) {

      // blocked in user administration
      form_set_error('name', t('The username %name has not been activated or is blocked.', array(
        '%name' => $form_state['values']['name'],
      )));
    }
    else {
      if (drupal_is_denied('user', $form_state['values']['name'])) {

        // denied by access controls
        form_set_error('name', t('The name %name is a reserved username.', array(
          '%name' => $form_state['values']['name'],
        )));
      }
    }
  }
}