Skip to content

Commit

Permalink
Merge pull request #31 from stape-io/fix-user-data-hashing
Browse files Browse the repository at this point in the history
Fix user data hashing
  • Loading branch information
kHorozhanov authored Aug 8, 2024
2 parents 90df51c + e09a5b9 commit 3abbfeb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
homepage: "https://stape.io/"
versions:
- sha: 6f6d47d9011bc247df34b08c0bafcd45d11fe3de
changeNotes: Fix user data hashing.
- sha: 3639d997b1a2d25404a82ddaa428e6af05aba1c0
changeNotes: Added common cookie support.
- sha: b0cb2a6c643dd0b5baea1db3d382a1f7bb3bb546
Expand Down
3 changes: 2 additions & 1 deletion template.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ function hashData(value) {

function hashDataIfNeeded(mappedData) {
if (mappedData.user) {
const userDataKeysToHash = ['external_id', 'phone', 'email', 'first_name', 'last_name', 'zip_code'];
for (let key in mappedData.user) {
if (key === 'external_id' || key === 'phone' || key === 'email') {
if (userDataKeysToHash.indexOf(key) !== -1) {
mappedData.user[key] = hashData(mappedData.user[key]);
}
}
Expand Down
3 changes: 2 additions & 1 deletion template.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,9 @@ function hashData(value) {

function hashDataIfNeeded(mappedData) {
if (mappedData.user) {
const userDataKeysToHash = ['external_id', 'phone', 'email', 'first_name', 'last_name', 'zip_code'];
for (let key in mappedData.user) {
if (key === 'external_id' || key === 'phone' || key === 'email') {
if (userDataKeysToHash.indexOf(key) !== -1) {
mappedData.user[key] = hashData(mappedData.user[key]);
}
}
Expand Down

0 comments on commit 3abbfeb

Please sign in to comment.