Skip to content

Commit

Permalink
Standardize Email Capitalization for User Queries
Browse files Browse the repository at this point in the history
When querying for a user by their email we now standardize the email to be lowercase to ensure we can find the users record. This is mostly used on the initial login when converting a user from the v2.0 LDAP User AuthType to the SAML User Auth type used in v2.1
  • Loading branch information
joelbcastillo authored Sep 8, 2017
1 parent 0c889de commit 49eb710
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/auth/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ def find_user_by_email(email):
).first()
return user if user.agencies.all() else None
elif current_app.config['USE_OAUTH']:
from sqlalchemy import func
return Users.query.filter(
Users.email == email,
func.lower(Users.email) == email.lower(),
Users.auth_user_type.in_(user_type_auth.AGENCY_USER_TYPES)
).first()
return None
Expand Down

0 comments on commit 49eb710

Please sign in to comment.