mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +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 #
|
||||
#========================#
|
||||
|
||||
ALLOW_EMAIL_LOGIN=true
|
||||
ALLOW_REGISTRATION=true
|
||||
ALLOW_SOCIAL_LOGIN=false
|
||||
ALLOW_SOCIAL_REGISTRATION=false
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ describe.skip('GET /', () => {
|
|||
githubLoginEnabled: true,
|
||||
discordLoginEnabled: true,
|
||||
serverDomain: 'http://test-server.com',
|
||||
emailLoginEnabled: 'true',
|
||||
registrationEnabled: 'true',
|
||||
socialLoginEnabled: 'true',
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ function Login() {
|
|||
{localize(getLoginError(error))}
|
||||
</div>
|
||||
)}
|
||||
<LoginForm onSubmit={login} />
|
||||
{startupConfig?.emailLoginEnabled && <LoginForm onSubmit={login} />}
|
||||
{startupConfig?.registrationEnabled && (
|
||||
<p className="my-4 text-center text-sm font-light text-gray-700">
|
||||
{' '}
|
||||
|
|
@ -44,7 +44,7 @@ function Login() {
|
|||
</a>
|
||||
</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="absolute bg-white px-3 text-xs">Or</div>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ const setup = ({
|
|||
githubLoginEnabled: true,
|
||||
discordLoginEnabled: true,
|
||||
registrationEnabled: true,
|
||||
emailLoginEnabled: true,
|
||||
socialLoginEnabled: true,
|
||||
serverDomain: 'mock-server',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ const setup = ({
|
|||
openidImageUrl: 'http://test-server.com',
|
||||
githubLoginEnabled: true,
|
||||
discordLoginEnabled: true,
|
||||
emailLoginEnabled: true,
|
||||
registrationEnabled: true,
|
||||
socialLoginEnabled: true,
|
||||
serverDomain: 'mock-server',
|
||||
|
|
|
|||
|
|
@ -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
|
||||
```
|
||||
```
|
||||
|
|
|
|||
|
|
@ -178,6 +178,7 @@ export type TStartupConfig = {
|
|||
openidImageUrl: string;
|
||||
discordLoginEnabled: boolean;
|
||||
serverDomain: string;
|
||||
emailLoginEnabled: boolean;
|
||||
registrationEnabled: boolean;
|
||||
socialLoginEnabled: boolean;
|
||||
emailEnabled: boolean;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue