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
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🔡 fix: Normalize Email Case When Issuing Verification Tokens (#14172)
VictorEPlus9446f3278c83
diff --git a/api/server/services/AuthService.js b/api/server/services/AuthService.jsindex 8f6c281ee1..a4a59bb8b6 100644--- a/api/server/services/AuthService.js+++ b/api/server/services/AuthService.js@@ -218,16 +218,17 @@ const createTokenHash = () => {*/const sendVerificationEmail = async (user) => {const [verifyToken, hash] = createTokenHash();+ const email = user.email.toLowerCase();const verificationLink = `${domains.client- }/verify?token=${verifyToken}&email=${encodeURIComponent(user.email)}`;+ }/verify?token=${verifyToken}&email=${encodeURIComponent(email)}`;await sendEmail({- email: user.email,+ email,subject: 'Verify your email',payload: {appName: process.env.APP_TITLE || 'LibreChat',- name: user.name || user.username || user.email,+ name: user.name || user.username || email,verificationLink: verificationLink,year: new Date().getFullYear(),},@@ -236,14 +237,14 @@ const sendVerificationEmail = async (user) => {await createToken({userId: user._id,- email: user.email,+ email,type: AuthTokenTypes.EMAIL_VERIFICATION,token: hash,createdAt: Date.now(),expiresIn: 900,});- logger.info(`[sendVerificationEmail] Verification link issued. [Email: ${user.email}]`);+ logger.info(`[sendVerificationEmail] Verification link issued. [Email: ${email}]`);};/**diff --git a/api/server/services/AuthService.spec.js b/api/server/services/AuthService.spec.jsindex 03579e7278..ce4dd517ff 100644--- a/api/server/services/AuthService.spec.js+++ b/api/server/services/AuthService.spec.js@@ -471,6 +471,31 @@ describe('registerUser', () => {}),);});++ it('normalizes mixed-case emails when issuing the verification token and link', async () => {+ checkEmailConfig.mockReturnValue(true);++ const result = await registerUser({+ ...registrationPayload,+ email: '[email protected]',+ });++ expect(result.status).toBe(200);+ expect(createToken).toHaveBeenCalledWith(+ expect.objectContaining({+ email: '[email protected]',+ type: 'email_verification',+ }),+ );+ expect(sendEmail).toHaveBeenCalledWith(+ expect.objectContaining({+ email: '[email protected]',+ payload: expect.objectContaining({+ verificationLink: expect.stringContaining(encodeURIComponent('[email protected]')),+ }),+ }),+ );+ });});describe('verifyEmail public response handling', () => {