You are here

function email_registration_user_login_validate in Email Registration 6

Same name and namespace in other branches
  1. 8 email_registration.module \email_registration_user_login_validate()
  2. 5 email_registration.module \email_registration_user_login_validate()
  3. 7 email_registration.module \email_registration_user_login_validate()

Custom validation function for user login form. Allows users to authenticate by email only, which is our preferred method.

2 string references to 'email_registration_user_login_validate'
email_registration_form_user_login_alter in ./email_registration.module
Implementation of hook_form_FORMID_alter().
email_registration_form_user_login_block_alter in ./email_registration.module
Implementation of hook_form_FORMID_alter().

File

./email_registration.module, line 177
For registration process without a username

Code

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

    // Keep the email value in form state for furher validation.
    $form_state['values']['email'] = $form_state['values']['name'];
    if ($name = db_result(db_query("SELECT name FROM {users} WHERE LOWER(mail) = LOWER('%s')", $form_state['values']['name']))) {
      $form_state['values']['name'] = $name;
    }
  }
}