Encode strings before hashing

This commit is contained in:
Sergey Motornyuk 2020-01-15 10:47:22 +02:00
parent 23abbe05de
commit 382e5e0620
1 changed files with 2 additions and 1 deletions

View File

@ -2,6 +2,7 @@
import hashlib import hashlib
import logging import logging
import six
from flask import Blueprint from flask import Blueprint
@ -77,7 +78,7 @@ def _post_analytics(
data_dict = { data_dict = {
"v": 1, "v": 1,
"tid": tk.config.get("googleanalytics.id"), "tid": tk.config.get("googleanalytics.id"),
"cid": hashlib.md5(tk.c.user).hexdigest(), "cid": hashlib.md5(six.ensure_binary(tk.c.user)).hexdigest(),
# customer id should be obfuscated # customer id should be obfuscated
"t": "event", "t": "event",
"dh": tk.request.environ["HTTP_HOST"], "dh": tk.request.environ["HTTP_HOST"],