You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2016/12/17 19:25:27 UTC

[3/5] incubator-ponymail git commit: preferences.lua should not return list data if it was not requested

preferences.lua should not return list data if it was not requested

This fixes #305

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/54b7d52a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/54b7d52a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/54b7d52a

Branch: refs/heads/master
Commit: 54b7d52a3a753d12cdbbce5a19e7de451c995b15
Parents: ae7669f
Author: Sebb <se...@apache.org>
Authored: Sat Dec 17 19:00:24 2016 +0000
Committer: Sebb <se...@apache.org>
Committed: Sat Dec 17 19:00:24 2016 +0000

----------------------------------------------------------------------
 CHANGELOG.md             |  1 +
 site/api/preferences.lua | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/54b7d52a/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 46ca9c2..645366d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -80,6 +80,7 @@
 - preferences.lua never fetches descriptions (#163)
 - API.md does not document all the stats.lua parameters (#115)
 - allow preferences to use non-default mail port (#303)
+- preferences.lua should not return list data if it was not requested (#305)
 
 
 ## CHANGES in 0.9b:

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/54b7d52a/site/api/preferences.lua
----------------------------------------------------------------------
diff --git a/site/api/preferences.lua b/site/api/preferences.lua
index 0f95fbb..b6552e1 100644
--- a/site/api/preferences.lua
+++ b/site/api/preferences.lua
@@ -210,7 +210,19 @@ Pony Mail - Email for Ponies and People.
         r:puts[[{"saved": true}]]
         return cross.OK
     end
-    
+
+    -- don't allow failed options to drop-thru
+    for _, v in pairs({'associate', 'verify', 'removealt', 'save', 'addfav', 'remfav'}) do
+        if get['header_' .. v] then
+            if not account then
+                r:puts(JSON.encode{error="Not logged in"})
+            else
+                r:puts(JSON.encode{error="Missing or invalid parameter(s)"})
+            end
+            return cross.OK
+        end
+    end
+
     -- Get lists (cached if possible)
     local lists = {}
     local NOWISH = math.floor(os.time() / 600)