diff --git a/.env.example b/.env.example
index 0869b28a1..8646f775b 100644
--- a/.env.example
+++ b/.env.example
@@ -214,6 +214,7 @@ CHECK_BALANCE=false
# Registration and Login #
#========================#
+ALLOW_EMAIL_LOGIN=true
ALLOW_REGISTRATION=true
ALLOW_SOCIAL_LOGIN=false
ALLOW_SOCIAL_REGISTRATION=false
diff --git a/api/server/routes/__tests__/config.spec.js b/api/server/routes/__tests__/config.spec.js
index 9194d458f..4833b83d1 100644
--- a/api/server/routes/__tests__/config.spec.js
+++ b/api/server/routes/__tests__/config.spec.js
@@ -62,6 +62,7 @@ describe.skip('GET /', () => {
githubLoginEnabled: true,
discordLoginEnabled: true,
serverDomain: 'http://test-server.com',
+ emailLoginEnabled: 'true',
registrationEnabled: 'true',
socialLoginEnabled: 'true',
});
diff --git a/api/server/routes/config.js b/api/server/routes/config.js
index c18d35541..9c02aa53f 100644
--- a/api/server/routes/config.js
+++ b/api/server/routes/config.js
@@ -1,6 +1,8 @@
const express = require('express');
const router = express.Router();
const { isEnabled } = require('../utils');
+const emailLoginEnabled =
+ process.env.ALLOW_EMAIL_LOGIN === undefined || isEnabled(process.env.ALLOW_EMAIL_LOGIN);
router.get('/', async function (req, res) {
try {
@@ -19,6 +21,7 @@ router.get('/', async function (req, res) {
githubLoginEnabled: !!process.env.GITHUB_CLIENT_ID && !!process.env.GITHUB_CLIENT_SECRET,
discordLoginEnabled: !!process.env.DISCORD_CLIENT_ID && !!process.env.DISCORD_CLIENT_SECRET,
serverDomain: process.env.DOMAIN_SERVER || 'http://localhost:3080',
+ emailLoginEnabled,
registrationEnabled: isEnabled(process.env.ALLOW_REGISTRATION),
socialLoginEnabled: isEnabled(process.env.ALLOW_SOCIAL_LOGIN),
emailEnabled:
diff --git a/client/src/components/Auth/Login.tsx b/client/src/components/Auth/Login.tsx
index c307a2490..6cb06e428 100644
--- a/client/src/components/Auth/Login.tsx
+++ b/client/src/components/Auth/Login.tsx
@@ -34,7 +34,7 @@ function Login() {
{localize(getLoginError(error))}
)}
-
+ {startupConfig?.emailLoginEnabled && }
{startupConfig?.registrationEnabled && (
{' '}
@@ -44,7 +44,7 @@ function Login() {
)}
- {startupConfig?.socialLoginEnabled && (
+ {startupConfig?.socialLoginEnabled && startupConfig?.emailLoginEnabled && (
<>
Or
diff --git a/client/src/components/Auth/__tests__/Login.spec.tsx b/client/src/components/Auth/__tests__/Login.spec.tsx
index 7025779f8..08b5df766 100644
--- a/client/src/components/Auth/__tests__/Login.spec.tsx
+++ b/client/src/components/Auth/__tests__/Login.spec.tsx
@@ -39,6 +39,7 @@ const setup = ({
githubLoginEnabled: true,
discordLoginEnabled: true,
registrationEnabled: true,
+ emailLoginEnabled: true,
socialLoginEnabled: true,
serverDomain: 'mock-server',
},
diff --git a/client/src/components/Auth/__tests__/Registration.spec.tsx b/client/src/components/Auth/__tests__/Registration.spec.tsx
index 5d2a68a2c..19877174e 100644
--- a/client/src/components/Auth/__tests__/Registration.spec.tsx
+++ b/client/src/components/Auth/__tests__/Registration.spec.tsx
@@ -39,6 +39,7 @@ const setup = ({
openidImageUrl: 'http://test-server.com',
githubLoginEnabled: true,
discordLoginEnabled: true,
+ emailLoginEnabled: true,
registrationEnabled: true,
socialLoginEnabled: true,
serverDomain: 'mock-server',
diff --git a/docs/install/dotenv.md b/docs/install/dotenv.md
index 2f7a1563c..53a7e8bb2 100644
--- a/docs/install/dotenv.md
+++ b/docs/install/dotenv.md
@@ -507,7 +507,10 @@ CHECK_BALANCE=false
### Registration and Login
see: [User/Auth System](../install/user_auth_system.md)
+
+
- General Settings:
+ - `ALLOW_EMAIL_LOGIN`: Email login. Set to `true` or `false` to enable or disable ONLY email login.
- `ALLOW_REGISTRATION`: Email registration of new users. Set to `true` or `false` to enable or disable Email registration.
- `ALLOW_SOCIAL_LOGIN`: Allow users to connect to LibreChat with various social networks, see below. Set to `true` or `false` to enable or disable.
- `ALLOW_SOCIAL_REGISTRATION`: Enable or disable registration of new user using various social network. Set to `true` or `false` to enable or disable.
@@ -668,4 +671,4 @@ Mail address for from field. It is **REQUIRED** to set a value here (even if it'
```bash
EMAIL_FROM=noreply@librechat.ai
-```
\ No newline at end of file
+```
diff --git a/packages/data-provider/src/types.ts b/packages/data-provider/src/types.ts
index 8b914b36f..a05e4f4e3 100644
--- a/packages/data-provider/src/types.ts
+++ b/packages/data-provider/src/types.ts
@@ -178,6 +178,7 @@ export type TStartupConfig = {
openidImageUrl: string;
discordLoginEnabled: boolean;
serverDomain: string;
+ emailLoginEnabled: boolean;
registrationEnabled: boolean;
socialLoginEnabled: boolean;
emailEnabled: boolean;