If a user use capital letters in your user name for the login, drupal return a message "name user or password unrecognized".

Drupal when searching the username will lowercase.

For example, if you register with the name "uSer" try to find "user".

If you change your own user names in the table of users, the problem is solved temporarily :/

Comments

ahmed.othman’s picture

The Username is not case sensitive so if i registered with username AHMED it should be the same if i registered with username ahmed, also i have the right to login with either ahmed or AHMED.

Salsero72’s picture

Version: 5.7 » 5.9

I encounter the same problem---

It's been encountered since version 4.
I am running 5.10.

Username IS case sensitive.

Last problem this morning

A person signed up with "Claudio". user already exists in the database,
but the scripts did not recognized the presense of another user with that username.

(somewhat way, the system reduced to lowercase)

So the user got the "new user pending registration mail" But no user was actually created

/**************************************************/
ERRATA CORRIGE
/**************************************************/

I found that the problem is generated by MYSQL. Not by php code.
The problem is from the function LOWER()

    else if (db_num_rows(db_query("SELECT uid FROM {users} WHERE uid != %d AND LOWER(name) = LOWER('%s')", $uid, $edit['name'])) > 0) {
      form_set_error('name', t('The name %name is already taken.', array('%name' => $edit['name'])));
    }

if you login to mysql console and perform
mysql> select lower('Test');
+---------------+
| lower('Test') |
+---------------+
| test |
+---------------+

BUT if you perform
mysql> SELECT uid FROM users WHERE uid != 0 AND LOWER(name) = LOWER('ExampleUser');
you get nothing BECAUSE
LOWER('ExampleUser') => gives 'exampleuser'
LOWER('ExampleUSER') => gives 'ExampleUSER'

The worst thing is that If you have THE SAME username..
like uid=100 namae = 'ExampleUser' (existing in the db)
and perform
mysql> SELECT uid FROM users WHERE uid != 0 AND LOWER(name) = LOWER('ExampleUser');
it gives NOTHING because the lowwered string returns 'exampleuser' but the lowered FIELD return 'ExampleUser' (ignoring the LOWER function)

Wasn't mysql case insensitive?
I applied the following patch at line 1389 user.module (function "_user_edit_validate")

    else if (db_num_rows(db_query("SELECT uid FROM {users} WHERE uid != %d AND (name) = ('%s')", $uid, $edit['name'])) > 0) {
      form_set_error('name', t('The name %name is already taken.', array('%name' => $edit['name'])));
    }

AND also on email validation

  else if (db_num_rows(db_query("SELECT uid FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) {
    form_set_error('mail', t('The e-mail address %email is already registered. <a href="@password">Have you forgotten your password?</a>', array('%email' => $edit['mail'], '@password' => url('user/password'))));
  }

Because at the moment I cannot not get the mysql issue ..

/**************************************************/
ERRATA CORRIGE 2
/**************************************************/

My patch does not work..@#@ WITHIN DRUPAL users table, the select is case sensitive
outside, it is not.

Select 'a'='A' > 1
Select uid from users where name = 'exampleuser' (table contains "ExamplUser") > 0 results

Art Morgan’s picture

Version: 5.9 » 5.12

We just upgraded to 5.12, and we have the same problem. I think this is a bug that's been around for a long time. Every time we upgrade we have the problem. From what I've heard, it doesn't affect new installs or sites that started from 5.x onward, so somehow nobody has checked in a fix.

we may have a solution in the systems.inc file. i will update if i can find it.

keith.smith’s picture

Title: Problems with the autentification of users » Problems with the authentification of users
dpearcefl’s picture

Status: Active » Closed (won't fix)

Considering the time elapsed between now and the last comment plus the fact that D5 is no longer supported, I am closing this ticket.