mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
📧 feat: disable login (ALLOW_EMAIL_LOGIN) (#1282)
* added ALLOW_EMAIL_LOGIN * update .env.example * fix(config) email login true by default * Update dotenv.md
This commit is contained in:
parent
1706886a64
commit
fdb65366d7
8 changed files with 14 additions and 3 deletions
|
|
@ -214,6 +214,7 @@ CHECK_BALANCE=false
|
||||||
# Registration and Login #
|
# Registration and Login #
|
||||||
#========================#
|
#========================#
|
||||||
|
|
||||||
|
ALLOW_EMAIL_LOGIN=true
|
||||||
ALLOW_REGISTRATION=true
|
ALLOW_REGISTRATION=true
|
||||||
ALLOW_SOCIAL_LOGIN=false
|
ALLOW_SOCIAL_LOGIN=false
|
||||||
ALLOW_SOCIAL_REGISTRATION=false
|
ALLOW_SOCIAL_REGISTRATION=false
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ describe.skip('GET /', () => {
|
||||||
githubLoginEnabled: true,
|
githubLoginEnabled: true,
|
||||||
discordLoginEnabled: true,
|
discordLoginEnabled: true,
|
||||||
serverDomain: 'http://test-server.com',
|
serverDomain: 'http://test-server.com',
|
||||||
|
emailLoginEnabled: 'true',
|
||||||
registrationEnabled: 'true',
|
registrationEnabled: 'true',
|
||||||
socialLoginEnabled: 'true',
|
socialLoginEnabled: 'true',
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const { isEnabled } = require('../utils');
|
const { isEnabled } = require('../utils');
|
||||||
|
const emailLoginEnabled =
|
||||||
|
process.env.ALLOW_EMAIL_LOGIN === undefined || isEnabled(process.env.ALLOW_EMAIL_LOGIN);
|
||||||
|
|
||||||
router.get('/', async function (req, res) {
|
router.get('/', async function (req, res) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -19,6 +21,7 @@ router.get('/', async function (req, res) {
|
||||||
githubLoginEnabled: !!process.env.GITHUB_CLIENT_ID && !!process.env.GITHUB_CLIENT_SECRET,
|
githubLoginEnabled: !!process.env.GITHUB_CLIENT_ID && !!process.env.GITHUB_CLIENT_SECRET,
|
||||||
discordLoginEnabled: !!process.env.DISCORD_CLIENT_ID && !!process.env.DISCORD_CLIENT_SECRET,
|
discordLoginEnabled: !!process.env.DISCORD_CLIENT_ID && !!process.env.DISCORD_CLIENT_SECRET,
|
||||||
serverDomain: process.env.DOMAIN_SERVER || 'http://localhost:3080',
|
serverDomain: process.env.DOMAIN_SERVER || 'http://localhost:3080',
|
||||||
|
emailLoginEnabled,
|
||||||
registrationEnabled: isEnabled(process.env.ALLOW_REGISTRATION),
|
registrationEnabled: isEnabled(process.env.ALLOW_REGISTRATION),
|
||||||
socialLoginEnabled: isEnabled(process.env.ALLOW_SOCIAL_LOGIN),
|
socialLoginEnabled: isEnabled(process.env.ALLOW_SOCIAL_LOGIN),
|
||||||
emailEnabled:
|
emailEnabled:
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ function Login() {
|
||||||
{localize(getLoginError(error))}
|
{localize(getLoginError(error))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<LoginForm onSubmit={login} />
|
{startupConfig?.emailLoginEnabled && <LoginForm onSubmit={login} />}
|
||||||
{startupConfig?.registrationEnabled && (
|
{startupConfig?.registrationEnabled && (
|
||||||
<p className="my-4 text-center text-sm font-light text-gray-700">
|
<p className="my-4 text-center text-sm font-light text-gray-700">
|
||||||
{' '}
|
{' '}
|
||||||
|
|
@ -44,7 +44,7 @@ function Login() {
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{startupConfig?.socialLoginEnabled && (
|
{startupConfig?.socialLoginEnabled && startupConfig?.emailLoginEnabled && (
|
||||||
<>
|
<>
|
||||||
<div className="relative mt-6 flex w-full items-center justify-center border border-t uppercase">
|
<div className="relative mt-6 flex w-full items-center justify-center border border-t uppercase">
|
||||||
<div className="absolute bg-white px-3 text-xs">Or</div>
|
<div className="absolute bg-white px-3 text-xs">Or</div>
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ const setup = ({
|
||||||
githubLoginEnabled: true,
|
githubLoginEnabled: true,
|
||||||
discordLoginEnabled: true,
|
discordLoginEnabled: true,
|
||||||
registrationEnabled: true,
|
registrationEnabled: true,
|
||||||
|
emailLoginEnabled: true,
|
||||||
socialLoginEnabled: true,
|
socialLoginEnabled: true,
|
||||||
serverDomain: 'mock-server',
|
serverDomain: 'mock-server',
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ const setup = ({
|
||||||
openidImageUrl: 'http://test-server.com',
|
openidImageUrl: 'http://test-server.com',
|
||||||
githubLoginEnabled: true,
|
githubLoginEnabled: true,
|
||||||
discordLoginEnabled: true,
|
discordLoginEnabled: true,
|
||||||
|
emailLoginEnabled: true,
|
||||||
registrationEnabled: true,
|
registrationEnabled: true,
|
||||||
socialLoginEnabled: true,
|
socialLoginEnabled: true,
|
||||||
serverDomain: 'mock-server',
|
serverDomain: 'mock-server',
|
||||||
|
|
|
||||||
|
|
@ -507,7 +507,10 @@ CHECK_BALANCE=false
|
||||||
### Registration and Login
|
### Registration and Login
|
||||||
see: [User/Auth System](../install/user_auth_system.md)
|
see: [User/Auth System](../install/user_auth_system.md)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
- General Settings:
|
- 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_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_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.
|
- `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
|
```bash
|
||||||
EMAIL_FROM=noreply@librechat.ai
|
EMAIL_FROM=noreply@librechat.ai
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -178,6 +178,7 @@ export type TStartupConfig = {
|
||||||
openidImageUrl: string;
|
openidImageUrl: string;
|
||||||
discordLoginEnabled: boolean;
|
discordLoginEnabled: boolean;
|
||||||
serverDomain: string;
|
serverDomain: string;
|
||||||
|
emailLoginEnabled: boolean;
|
||||||
registrationEnabled: boolean;
|
registrationEnabled: boolean;
|
||||||
socialLoginEnabled: boolean;
|
socialLoginEnabled: boolean;
|
||||||
emailEnabled: boolean;
|
emailEnabled: boolean;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue