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

{localize('com_auth_welcome_back')}

{error && (
{localize('com_auth_error_login')}
)} {startupConfig?.registrationEnabled && (

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

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

{localize('com_auth_google_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;