🔄🔐 refactor: auth; style: match OpenAI; feat: custom social login order (#1421)

* refactor(Login & Registration)

* fix(Registration) test errors

* refactor(LoginForm & ResetPassword)

* fix(LoginForm): display 'undefined' when loading page; style(SocialButton): match OpenAI's graphics

* some refactor and style update for social logins

* style: width like OpenAI; feat: custom social login order; refactor: alphabetical socials

* fix(Registration & Login) test

* Update .env.example

* Update .env.example

* Update dotenv.md

* refactor: remove `SOCIAL_LOGIN_ORDER` for `socialLogins` configured from `librechat.yaml`
- initialized by AppService, attached as app.locals property
- rename socialLoginOrder and loginOrder to socialLogins app-wide for consistency
- update types and docs
- initialize config variable as array and not singular string to parse
- bump data-provider to 0.3.9

---------

Co-authored-by: Danny Avila <messagedaniel@protonmail.com>
This commit is contained in:
Marco Beretta 2024-02-05 09:31:18 +01:00 committed by GitHub
parent 25da90657d
commit a2c35e8415
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 536 additions and 532 deletions

View file

@ -31,6 +31,7 @@ Stay tuned for ongoing enhancements to customize your LibreChat instance!
- [Registration](#registration)
- [Endpoints](#endpoints)
- [Registration Object Structure](#registration-object-structure)
- [**socialLogins**:](#socialLogins)
- [**allowedDomains**:](#allowedDomains)
- [Custom Endpoint Object Structure](#custom-endpoint-object-structure)
- [**name**:](#name)
@ -112,6 +113,9 @@ docker-compose up # no need to rebuild
- **Key**: `registration`
- **Type**: Object
- **Description**: Configures registration-related settings for the application.
- **Sub-Key**: `socialLogins`
- **Type**: Array of Strings (`"google"`, `"facebook"`, `"openid"`, `"github"`, `"discord"`)
- **Description**: Determines both the available social login providers and their arranged order to list on the login/registration page, from top to bottom (first to last values). Note: a login option will not appear even if listed if not [properly configured.](./user_auth_system.md#social-authentication-setup-and-configuration)
- **Sub-Key**: `allowedDomains`
- **Type**: Array of Strings
- **Description**: Specifies a list of allowed email domains for user registration. Users attempting to register with email domains not listed here will be restricted from registering.
@ -132,11 +136,23 @@ docker-compose up # no need to rebuild
```yaml
# Example Registration Object Structure
registration:
socialLogins: ["google", "facebook", "github", "discord", "openid"]
allowedDomains:
- "gmail.com"
- "protonmail.com"
```
### **socialLogins**:
> Defines the available social login providers and their display order.
- Type: Array of Strings
- Example:
```yaml
socialLogins: ["google", "facebook", "github", "discord", "openid"]
```
- **Note**: The order of the providers in the list determines their appearance order on the login/registration page. Each provider listed must be [properly configured](./user_auth_system.md#social-authentication-setup-and-configuration) within the system to be active and available for users. This configuration allows for a tailored authentication experience, emphasizing the most relevant or preferred social login options for your user base.
### **allowedDomains**:
> A list specifying allowed email domains for registration.

View file

@ -666,7 +666,6 @@ see: **[User/Auth System](../configuration/user_auth_system.md)**
```bash
ALLOW_EMAIL_LOGIN=true
ALLOW_REGISTRATION=true
ALLOWED_REGISTRATION_DOMAINS=
ALLOW_SOCIAL_LOGIN=false
ALLOW_SOCIAL_REGISTRATION=false
```