diff --git a/server/avatar.js b/server/avatar.js index a3fb8551..c2751556 100644 --- a/server/avatar.js +++ b/server/avatar.js @@ -7,6 +7,9 @@ export default async (db, user) => { } else if (user.avatarSource === 'gravatar') { return gravatar(user); } else if (user.avatarSource) { + if (user.payload) { + return JSON.parse(user.payload).avatar; + } const auth = await db.get(SQL` SELECT payload FROM authenticators WHERE type = ${user.avatarSource} diff --git a/server/routes/admin.js b/server/routes/admin.js index 5d1c0f1a..034c3c31 100644 --- a/server/routes/admin.js +++ b/server/routes/admin.js @@ -13,9 +13,10 @@ const router = Router(); router.get('/admin/list', handleErrorAsync(async (req, res) => { return res.json(await caches.admins.fetch(async () => { const admins = await req.db.all(SQL` - SELECT u.username, p.teamName, p.locale, u.id, u.email, u.avatarSource, p.credentials, p.credentialsLevel, p.credentialsName + SELECT u.username, p.teamName, p.locale, u.id, u.email, u.avatarSource, p.credentials, p.credentialsLevel, p.credentialsName, a.payload FROM users u - LEFT JOIN profiles p ON p.userId = u.id + LEFT JOIN profiles p ON p.userId = u.id + LEFT JOIN authenticators a ON u.id = a.userId AND a.type = u.avatarSource AND (a.validUntil IS NULL OR a.validUntil > ${now()}) WHERE p.teamName IS NOT NULL AND p.teamName != '' ORDER BY RANDOM() @@ -34,6 +35,7 @@ router.get('/admin/list', handleErrorAsync(async (req, res) => { admin.avatar = await avatar(req.db, admin); delete admin.id; delete admin.email; + delete admin.payload; if (admin.credentials) { admin.credentials = admin.credentials.split('|'); }