You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2016/06/01 06:47:25 UTC
incubator-ponymail git commit: also anonymize here
Repository: incubator-ponymail
Updated Branches:
refs/heads/master c20eb984e -> 622d5a173
also anonymize here
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/622d5a17
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/622d5a17
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/622d5a17
Branch: refs/heads/master
Commit: 622d5a173a7d62b53b2ff939bc45d2100c3695ac
Parents: c20eb98
Author: humbedooh <hu...@apache.org>
Authored: Wed Jun 1 08:47:09 2016 +0200
Committer: humbedooh <hu...@apache.org>
Committed: Wed Jun 1 08:47:09 2016 +0200
----------------------------------------------------------------------
site/api/email.lua | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/622d5a17/site/api/email.lua
----------------------------------------------------------------------
diff --git a/site/api/email.lua b/site/api/email.lua
index c28c6c7..429eae8 100644
--- a/site/api/email.lua
+++ b/site/api/email.lua
@@ -24,6 +24,20 @@ local user = require 'lib/user'
local cross = require 'lib/cross'
local config = require 'lib/config'
+-- anonymizer func
+function anonymize(doc)
+ if doc.from and #doc.from > 0 then
+ doc.from = doc.from:gsub("(%S+)@(%S+)", function(a,b) return a:sub(1,2) .. "..." .. "@" .. b end)
+ end
+ if doc.cc and #doc.cc > 0 then
+ doc.cc = doc.cc:gsub("(%S+)@(%S+)", function(a,b) return a:sub(1,2) .. "..." .. "@" .. b end)
+ end
+ if doc.to and #doc.to > 0 then
+ doc.to = doc.to:gsub("(%S+)@(%S+)", function(a,b) return a:sub(1,2) .. "..." .. "@" .. b end)
+ end
+ return doc
+end
+
function handle(r)
r.content_type = "application/json"
local get = r:parseargs()
@@ -112,7 +126,7 @@ function handle(r)
eml = "unknown"
end
if not account then -- anonymize email address if not logged in
- doc.from = doc.from:gsub("(%S+)@(%S+)", function(a,b) return a:sub(1,2) .. "..." .. "@" .. b end)
+ doc = anonymize(doc)
if doc.from_raw then
doc.from_raw = doc.from_raw:gsub("(%S+)@(%S+)", function(a,b) return a:sub(1,2) .. "..." .. "@" .. b end)
end