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

✉️ fix: Fallback For User Name In Email Templates (#6620)

Danny Avilad60f2ed50be4
diff --git a/api/server/services/AuthService.js b/api/server/services/AuthService.js
index 3c02b7eea0..6ad4a3acf7 100644
--- a/api/server/services/AuthService.js
+++ b/api/server/services/AuthService.js
@@ -91,7 +91,7 @@ const sendVerificationEmail = async (user) => {
subject: 'Verify your email',
payload: {
appName: process.env.APP_TITLE || 'LibreChat',
- name: user.name,
+ name: user.name || user.username || user.email,
verificationLink: verificationLink,
year: new Date().getFullYear(),
},
@@ -278,7 +278,7 @@ const requestPasswordReset = async (req) => {
subject: 'Password Reset Request',
payload: {
appName: process.env.APP_TITLE || 'LibreChat',
- name: user.name,
+ name: user.name || user.username || user.email,
link: link,
year: new Date().getFullYear(),
},
@@ -331,7 +331,7 @@ const resetPassword = async (userId, token, password) => {
subject: 'Password Reset Successfully',
payload: {
appName: process.env.APP_TITLE || 'LibreChat',
- name: user.name,
+ name: user.name || user.username || user.email,
year: new Date().getFullYear(),
},
template: 'passwordReset.handlebars',
@@ -414,7 +414,7 @@ const resendVerificationEmail = async (req) => {
subject: 'Verify your email',
payload: {
appName: process.env.APP_TITLE || 'LibreChat',
- name: user.name,
+ name: user.name || user.username || user.email,
verificationLink: verificationLink,
year: new Date().getFullYear(),
},
diff --git a/api/typedefs.js b/api/typedefs.js
index 74d9ef5209..9d35c64580 100644
--- a/api/typedefs.js
+++ b/api/typedefs.js
@@ -765,12 +765,19 @@
* @typedef {import('mongoose').Schema} MongooseSchema
* @memberof typedefs
*/
+
/**
* @exports MongoFile
* @typedef {import('@librechat/data-schemas').IMongoFile} MongoFile
* @memberof typedefs
*/
+/**
+ * @exports MongoUser
+ * @typedef {import('@librechat/data-schemas').IUser} MongoUser
+ * @memberof typedefs
+ */
+
/**
* @exports ObjectId
* @typedef {import('mongoose').Types.ObjectId} ObjectId