mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
Strip whitespace from emails before looking up DB entries in a few places.
(imported from commit eafdce98450d16c0ca51c4cb17a139811a6124bc)
This commit is contained in:
@@ -228,7 +228,7 @@ def user_profile_by_email_cache_key(email):
|
||||
# See the comment in zerver/lib/avatar.py:gravatar_hash for why we
|
||||
# are proactively encoding email addresses even though they will
|
||||
# with high likelihood be ASCII-only for the foreseeable future.
|
||||
return 'user_profile_by_email:%s' % (make_safe_digest(email),)
|
||||
return 'user_profile_by_email:%s' % (make_safe_digest(email.strip()),)
|
||||
|
||||
def user_profile_by_id_cache_key(user_profile_id):
|
||||
return "user_profile_by_id:%s" % (user_profile_id,)
|
||||
|
||||
@@ -942,7 +942,7 @@ def get_user_profile_by_id(uid):
|
||||
|
||||
@cache_with_key(user_profile_by_email_cache_key, timeout=3600*24*7)
|
||||
def get_user_profile_by_email(email):
|
||||
return UserProfile.objects.select_related().get(email__iexact=email)
|
||||
return UserProfile.objects.select_related().get(email__iexact=email.strip())
|
||||
|
||||
@cache_with_key(active_user_dicts_in_realm_cache_key, timeout=3600*24*7)
|
||||
def get_active_user_dicts_in_realm(realm):
|
||||
@@ -952,7 +952,7 @@ def get_active_user_dicts_in_realm(realm):
|
||||
def get_prereg_user_by_email(email):
|
||||
# A user can be invited many times, so only return the result of the latest
|
||||
# invite.
|
||||
return PreregistrationUser.objects.filter(email__iexact=email).latest("invited_at")
|
||||
return PreregistrationUser.objects.filter(email__iexact=email.strip()).latest("invited_at")
|
||||
|
||||
class Huddle(models.Model):
|
||||
# TODO: We should consider whether using
|
||||
|
||||
Reference in New Issue
Block a user