mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
Move code that escapes special chars to helper function and use it
in query get_users_by_partial_email
This commit is contained in:
@@ -6,6 +6,7 @@ from sqlalchemy.orm import joinedload
|
||||
|
||||
from app import db
|
||||
from app.models import (User, VerifyCode)
|
||||
from app.utils import escape_special_characters
|
||||
|
||||
|
||||
def _remove_values_for_keys_if_present(dict, keys):
|
||||
@@ -98,7 +99,8 @@ def get_user_by_email(email):
|
||||
|
||||
|
||||
def get_users_by_partial_email(email):
|
||||
return User.query.filter(User.email_address.ilike("\%{}\%".format(email))).all()
|
||||
email = escape_special_characters(email)
|
||||
return User.query.filter(User.email_address.ilike("%{}%".format(email))).all()
|
||||
|
||||
|
||||
def increment_failed_login_count(user):
|
||||
|
||||
Reference in New Issue
Block a user