Functions to load user by name or email should be case insensitive

Created on 5 May 2017, over 7 years ago
Updated 18 October 2024, 2 months ago

The functions user_load_by_name() and user_load_by_mail() are just wrappers for entity_load() ultimately. They use the deprecated parameter $conditions to pass the account name and the email address respectively. However, these conditions are added using a simple equality comparison. Thus, differences in the case are not ignored. This behavior differs from the user register form, where the client wouldn't be able to create another account using an username or an e-mail address already registered by just changing their case.

Furthermore, this behavior leads to errors on contrib projects. For example, I use the LDAP module, which relies on these functions to check if an account with the provided username or email exists. Hence, multiple accounts can be created by simply changing words case. I don't think it's a problem with LDAP module as the aforementioned functions do not work as expected.

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

user.module

Created by

🇧🇷Brazil dbiscalchin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
Production build 0.71.5 2024