Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using SQLAlchemy finding users and emails uses special characters #234

Open
CodeRhymesLife opened this issue Sep 28, 2018 · 0 comments

Comments

@CodeRhymesLife
Copy link

ACTUAL:
user_manager.find_user_by_email() and user_manager.find_user_by_username() do not ignore special characters, such as _ which is treated as a wildcard. This results in finding emails and usernames that should not be found. For example, if there is a user with email user1@example.com searching for user_manager.find_user_by_email('user_@example.com') will return the User object for user1@example.com because _ is a wildcard character.

EXPECTED:
Special characters are not used, so user_manager.find_user_by_email('user_@example.com') does not find user1@example.com

DIAGNOSIS:
Both user_manager.find_user_by_email() and user_manager.find_user_by_username() make calls to user_manager.ifind_first_object() which, in an attempt to make case INsensitive lookups, filters using the sql LIKE clause. The LIKE clause uses special characters, such as _, which results in unexpected results.

POTENTIAL SOLUTION:
Instead of using the LIKE clause to do case INsensitive lookups we can use sqlalchemy.func.lower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant