🔄🔐 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

@ -32,14 +32,14 @@ const setup = ({
isLoading: false,
isError: false,
data: {
googleLoginEnabled: true,
socialLogins: ['google', 'facebook', 'openid', 'github', 'discord'],
discordLoginEnabled: true,
facebookLoginEnabled: true,
githubLoginEnabled: true,
googleLoginEnabled: true,
openidLoginEnabled: true,
openidLabel: 'Test OpenID',
openidImageUrl: 'http://test-server.com',
githubLoginEnabled: true,
discordLoginEnabled: true,
emailLoginEnabled: true,
registrationEnabled: true,
socialLoginEnabled: true,
serverDomain: 'mock-server',
@ -85,23 +85,23 @@ test('renders registration form', () => {
expect(getByRole('button', { name: /Submit registration/i })).toBeInTheDocument();
expect(getByRole('link', { name: 'Login' })).toBeInTheDocument();
expect(getByRole('link', { name: 'Login' })).toHaveAttribute('href', '/login');
expect(getByRole('link', { name: /Login with Google/i })).toBeInTheDocument();
expect(getByRole('link', { name: /Login with Google/i })).toHaveAttribute(
expect(getByRole('link', { name: /Continue with Google/i })).toBeInTheDocument();
expect(getByRole('link', { name: /Continue with Google/i })).toHaveAttribute(
'href',
'mock-server/oauth/google',
);
expect(getByRole('link', { name: /Login with Facebook/i })).toBeInTheDocument();
expect(getByRole('link', { name: /Login with Facebook/i })).toHaveAttribute(
expect(getByRole('link', { name: /Continue with Facebook/i })).toBeInTheDocument();
expect(getByRole('link', { name: /Continue with Facebook/i })).toHaveAttribute(
'href',
'mock-server/oauth/facebook',
);
expect(getByRole('link', { name: /Login with Github/i })).toBeInTheDocument();
expect(getByRole('link', { name: /Login with Github/i })).toHaveAttribute(
expect(getByRole('link', { name: /Continue with Github/i })).toBeInTheDocument();
expect(getByRole('link', { name: /Continue with Github/i })).toHaveAttribute(
'href',
'mock-server/oauth/github',
);
expect(getByRole('link', { name: /Login with Discord/i })).toBeInTheDocument();
expect(getByRole('link', { name: /Login with Discord/i })).toHaveAttribute(
expect(getByRole('link', { name: /Continue with Discord/i })).toBeInTheDocument();
expect(getByRole('link', { name: /Continue with Discord/i })).toHaveAttribute(
'href',
'mock-server/oauth/discord',
);