You are here

function logintoboggan_user_login_validate in LoginToboggan 7

Same name and namespace in other branches
  1. 8 logintoboggan.module \logintoboggan_user_login_validate()
  2. 5 logintoboggan.module \logintoboggan_user_login_validate()
  3. 6 logintoboggan.module \logintoboggan_user_login_validate()

Custom validation for user login form

1 string reference to 'logintoboggan_user_login_validate'
logintoboggan_form_alter in ./logintoboggan.module
Implement hook_form_alter().

File

./logintoboggan.module, line 536
LoginToboggan module

Code

function logintoboggan_user_login_validate($form, &$form_state) {
  if (isset($form_state['values']['name']) && $form_state['values']['name']) {
    if ($name = db_query("SELECT name FROM {users} WHERE LOWER(mail) = LOWER(:name)", array(
      ':name' => trim($form_state['values']['name']),
    ))
      ->fetchField()) {
      form_set_value($form['name'], $name, $form_state);
    }
  }
}