From 49eb710d05d734caa5737ea15551e68b89edb975 Mon Sep 17 00:00:00 2001 From: Joel Castillo Date: Fri, 8 Sep 2017 11:41:07 -0400 Subject: [PATCH] Standardize Email Capitalization for User Queries 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 --- app/auth/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/auth/utils.py b/app/auth/utils.py index fb9c327e4..12a8959e2 100644 --- a/app/auth/utils.py +++ b/app/auth/utils.py @@ -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