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

This commit is contained in:
Danny Avila 2025-03-29 15:02:59 -04:00 committed by GitHub
parent c381fc3ff0
commit d60f2ed50b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 4 deletions

View file

@ -91,7 +91,7 @@ const sendVerificationEmail = async (user) => {
subject: 'Verify your email', subject: 'Verify your email',
payload: { payload: {
appName: process.env.APP_TITLE || 'LibreChat', appName: process.env.APP_TITLE || 'LibreChat',
name: user.name, name: user.name || user.username || user.email,
verificationLink: verificationLink, verificationLink: verificationLink,
year: new Date().getFullYear(), year: new Date().getFullYear(),
}, },
@ -278,7 +278,7 @@ const requestPasswordReset = async (req) => {
subject: 'Password Reset Request', subject: 'Password Reset Request',
payload: { payload: {
appName: process.env.APP_TITLE || 'LibreChat', appName: process.env.APP_TITLE || 'LibreChat',
name: user.name, name: user.name || user.username || user.email,
link: link, link: link,
year: new Date().getFullYear(), year: new Date().getFullYear(),
}, },
@ -331,7 +331,7 @@ const resetPassword = async (userId, token, password) => {
subject: 'Password Reset Successfully', subject: 'Password Reset Successfully',
payload: { payload: {
appName: process.env.APP_TITLE || 'LibreChat', appName: process.env.APP_TITLE || 'LibreChat',
name: user.name, name: user.name || user.username || user.email,
year: new Date().getFullYear(), year: new Date().getFullYear(),
}, },
template: 'passwordReset.handlebars', template: 'passwordReset.handlebars',
@ -414,7 +414,7 @@ const resendVerificationEmail = async (req) => {
subject: 'Verify your email', subject: 'Verify your email',
payload: { payload: {
appName: process.env.APP_TITLE || 'LibreChat', appName: process.env.APP_TITLE || 'LibreChat',
name: user.name, name: user.name || user.username || user.email,
verificationLink: verificationLink, verificationLink: verificationLink,
year: new Date().getFullYear(), year: new Date().getFullYear(),
}, },

View file

@ -765,12 +765,19 @@
* @typedef {import('mongoose').Schema} MongooseSchema * @typedef {import('mongoose').Schema} MongooseSchema
* @memberof typedefs * @memberof typedefs
*/ */
/** /**
* @exports MongoFile * @exports MongoFile
* @typedef {import('@librechat/data-schemas').IMongoFile} MongoFile * @typedef {import('@librechat/data-schemas').IMongoFile} MongoFile
* @memberof typedefs * @memberof typedefs
*/ */
/**
* @exports MongoUser
* @typedef {import('@librechat/data-schemas').IUser} MongoUser
* @memberof typedefs
*/
/** /**
* @exports ObjectId * @exports ObjectId
* @typedef {import('mongoose').Types.ObjectId} ObjectId * @typedef {import('mongoose').Types.ObjectId} ObjectId