Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

update profile picture (#792)

Marco Beretta1dacfa49f06e
diff --git a/api/strategies/discordStrategy.js b/api/strategies/discordStrategy.js
index 685c81a47f..3b4c1513d5 100644
--- a/api/strategies/discordStrategy.js
+++ b/api/strategies/discordStrategy.js
@@ -17,11 +17,6 @@ const discordLogin = async () =>
const email = profile.email;
const discordId = profile.id;
- const oldUser = await User.findOne({ email });
- if (oldUser) {
- return cb(null, oldUser);
- }
-
let avatarURL;
if (profile.avatar) {
const format = profile.avatar.startsWith('a_') ? 'gif' : 'png';
@@ -31,6 +26,13 @@ const discordLogin = async () =>
avatarURL = `https://cdn.discordapp.com/embed/avatars/${defaultAvatarNum}.png`;
}
+ const oldUser = await User.findOne({ email });
+ if (oldUser) {
+ oldUser.avatar = avatarURL;
+ await oldUser.save();
+ return cb(null, oldUser);
+ }
+
const newUser = await User.create({
provider: 'discord',
discordId,
diff --git a/api/strategies/githubStrategy.js b/api/strategies/githubStrategy.js
index e021afbce1..e663e92cac 100644
--- a/api/strategies/githubStrategy.js
+++ b/api/strategies/githubStrategy.js
@@ -23,6 +23,8 @@ const githubLogin = async () =>
const oldUser = await User.findOne({ email });
if (oldUser) {
+ oldUser.avatar = profile.photos[0].value;
+ await oldUser.save();
return cb(null, oldUser);
}
diff --git a/api/strategies/googleStrategy.js b/api/strategies/googleStrategy.js
index 7b02757e30..c44d2ef733 100644
--- a/api/strategies/googleStrategy.js
+++ b/api/strategies/googleStrategy.js
@@ -17,6 +17,8 @@ const googleLogin = async () =>
try {
const oldUser = await User.findOne({ email: profile.emails[0].value });
if (oldUser) {
+ oldUser.avatar = profile.photos[0].value;
+ await oldUser.save();
return cb(null, oldUser);
}
} catch (err) {