import { useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import { useGetStartupConfig } from 'librechat-data-provider/react-query'; import { GoogleIcon, FacebookIcon, OpenIDIcon, GithubIcon, DiscordIcon } from '~/components'; import { useAuthContext } from '~/hooks/AuthContext'; import { getLoginError } from '~/utils'; import { useLocalize } from '~/hooks'; import LoginForm from './LoginForm'; function Login() { const { login, error, isAuthenticated } = useAuthContext(); const { data: startupConfig } = useGetStartupConfig(); const localize = useLocalize(); const navigate = useNavigate(); useEffect(() => { if (isAuthenticated) { navigate('/c/new', { replace: true }); } }, [isAuthenticated, navigate]); return (

{localize('com_auth_welcome_back')}

{error && (
{localize(getLoginError(error))}
)} {startupConfig?.emailLoginEnabled && } {startupConfig?.registrationEnabled && (

{' '} {localize('com_auth_no_account')}{' '} {localize('com_auth_sign_up')}

)} {startupConfig?.socialLoginEnabled && startupConfig?.emailLoginEnabled && ( <>
Or
)} {startupConfig?.googleLoginEnabled && startupConfig?.socialLoginEnabled && ( <>

{localize('com_auth_google_login')}

)} {startupConfig?.facebookLoginEnabled && startupConfig?.socialLoginEnabled && ( <>

{localize('com_auth_facebook_login')}

)} {startupConfig?.openidLoginEnabled && startupConfig?.socialLoginEnabled && ( <>
{startupConfig.openidImageUrl ? ( OpenID Logo ) : ( )}

{startupConfig.openidLabel}

)} {startupConfig?.githubLoginEnabled && startupConfig?.socialLoginEnabled && ( <>

{localize('com_auth_github_login')}

)} {startupConfig?.discordLoginEnabled && startupConfig?.socialLoginEnabled && ( <>

{localize('com_auth_discord_login')}

)}
); } export default Login;