1
0
Fork 0
forked from fnux/rt2zammad

Properly handle uppercase emails

Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
Michal Čihař 2019-05-27 13:19:16 +02:00
parent b67ae6487b
commit 4a0a453236

View file

@ -137,12 +137,13 @@ for user in target.user.all():
def get_user(userdata): def get_user(userdata):
email = userdata["EmailAddress"] email = userdata["EmailAddress"]
lemail = email.lower()
# Search existing users # Search existing users
if email not in USERMAP: if lemail not in USERMAP:
for user in target.user.search({"query": email}): for user in target.user.search({"query": email}):
USERMAP[user["email"].lower()] = user["login"] USERMAP[user["email"].lower()] = user["login"]
# Create new one # Create new one
if email not in USERMAP: if lemail not in USERMAP:
kwargs = {"email": email} kwargs = {"email": email}
if "RealName" in userdata: if "RealName" in userdata:
realname = userdata["RealName"] realname = userdata["RealName"]
@ -158,7 +159,7 @@ def get_user(userdata):
user = target.user.create(kwargs) user = target.user.create(kwargs)
USERMAP[user["email"].lower()] = user["login"] USERMAP[user["email"].lower()] = user["login"]
return USERMAP[email.lower()] return USERMAP[lemail]
# Create tickets # Create tickets