PHP-Auth icon indicating copy to clipboard operation
PHP-Auth copied to clipboard

Make username case insensitive

Open Forceu opened this issue 4 years ago • 5 comments

When logging in by username, the username was case-sensitive. This PR makes it case-insensitive

Forceu avatar Jan 09 '21 22:01 Forceu

Thanks!

That’s indeed the behavior we want (case-insensitive).

What database system are you using though? SQLite, I guess?

As far as I remember, that COLLATE NOCASE in a query would be specific to SQLite, not part of the standard, and incompatible with the other database systems that we support. So we can’t add it there.

But can’t we add COLLATE NOCASE to the column definitions (of the few affected columns) instead? That would mean we change the schema in Database/SQLite.sql instead. This could also be a little faster (because indexes are built the right way).

What do you think?

ocram avatar Jan 30 '21 17:01 ocram

Yes, I am using SQLite3 indeed. Sorry, I thought this statement was only for sqlite. In that case it is probably best to use your way and I will close this PR. Thanks for the feedback! :)

Forceu avatar Jan 31 '21 18:01 Forceu

No problem!

Could you test the alternative solution of using COLLATE on the columns in the schema (and removing it from the query again)? Or aren’t you interested in this anymore (at the moment)?

(I’ll leave this open until any solution for this problem has been implemented.)

ocram avatar Jan 31 '21 18:01 ocram

I will test it later this week!

Forceu avatar Jan 31 '21 18:01 Forceu

Thanks!

It’s the three columns

users.email
users.username
users_confirmations.email

where the COLLATE clause would have to be added.

ocram avatar Feb 01 '21 17:02 ocram