When installing "logintoboggan" to use the email as login user session and install "security login" to limit the number of failed attempts to login, the module "login security" does not count the failed attempt with email .
What happens is that the module "security login" saves not only the username and email, what should be done is the following:

replace this function "login_security_set_login_timestamp" (Line 108 - login_security.module) with the following code

function login_security_set_login_timestamp($form, &$form_state) {
  if(strpos($form_state['values']['name'],'@')){
     $aux = search_mail_by_name($form_state['values']['name']);
     $form_state['values']['name']=$aux['name'];
  }
  $account = db_select('users', 'u')
    ->fields('u', array('login', 'access'))
    ->condition('name', $form_state['values']['name'])
    ->condition('status', 1)
    ->execute()
    ->fetchAssoc();
  if (empty($account)) {
    return;
  }

  _login_security_login_timestamp($account['login']);
  _login_security_access_timestamp($account['access']);

  // Save entry in security log, Username and IP Address.
  _login_security_add_event($form_state['values']['name'], ip_address());
}

and add the following function

/*Busca nombre de usuario por email*/
function search_mail_by_name($mmail){

 $query = db_select('users', 'usu');
 $query->fields('usu',array('name'))
   ->condition('mail', $mmail,'=');
   $result = $query->execute();
   while($record = $result->fetchAssoc()) {
       return $record;
   }
}

I hope there's another more optimal way to correct this error.

Thank you,

Harold Peña Solorzano
Drupal developer
Bogota, Colombia

Comments

WorldFallz’s picture

I appreciate that you're trying to help users, but for the benefit of others particularly newbies, I have to point out that hacking a module is never the correct way to solve an issue. This essentially creates a fork of the module that will no longer receive the benefits of community participation and maintenance as well as have to be individually and manually maintained.

You should consider submitting your changes as a patch! Most module maintainers are happy to have patches and community participation.