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 2020/09/07 20:04:34 UTC

[incubator-ponymail-foal] 06/10: spit out creds if available.

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit 812ae8f88ebb664441ff7729e98d6bf649c5a8db
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Mon Sep 7 22:01:23 2020 +0200

    spit out creds if available.
---
 server/endpoints/preferences.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/server/endpoints/preferences.py b/server/endpoints/preferences.py
index bfd7e3b..9e6a965 100644
--- a/server/endpoints/preferences.py
+++ b/server/endpoints/preferences.py
@@ -17,13 +17,14 @@
 
 import plugins.server
 import plugins.aaa
+import plugins.session
 
 """ Generic preferences endpoint for Pony Mail codename Foal"""
 """ This is incomplete, but will work for anonymous tests. """
 
 
 async def process(
-    server: plugins.server.BaseServer, session: dict, indata: dict
+    server: plugins.server.BaseServer, session: plugins.session.SessionObject, indata: dict
 ) -> dict:
     prefs = {"login": {}}
     lists = {}
@@ -38,6 +39,14 @@ async def process(
                     lists[ldomain] = {}
                 lists[ldomain][lname] = entry["count"]
     prefs["lists"] = lists
+    if session and session.credentials:
+        prefs['login'] = {
+            "credentials": {
+                "uid": session.credentials.uid,
+                "email": session.credentials.email,
+                "fullname": session.credentials.name,
+            }
+        }
 
     return prefs