diff --git a/src/client/pages/auth/login.tsx b/src/client/pages/auth/login.tsx index 0b94cd5b..fa79a85f 100644 --- a/src/client/pages/auth/login.tsx +++ b/src/client/pages/auth/login.tsx @@ -33,7 +33,7 @@ import { IconCircleKeyFilled, } from '@tabler/icons-react'; import { useEffect, useState } from 'react'; -import { useNavigate } from 'react-router-dom'; +import { Link, useNavigate } from 'react-router-dom'; import useSWR from 'swr'; import GenericError from '../../error/GenericError'; import { eitherTrue } from '@/lib/primitive'; @@ -43,7 +43,11 @@ export default function Login() { const query = new URLSearchParams(location.search); const navigate = useNavigate(); - const { user, mutate } = useLogin(); + const { user, mutate } = useLogin({ + swrConfig: { + shouldRetryOnError: false + }, + }); const isHttps = window.location.protocol === 'https:'; const webClient = JSON.stringify(getWebClient()); @@ -212,6 +216,7 @@ export default function Login() { config.oauthEnabled.github, config.oauthEnabled.google, config.oauthEnabled.oidc, + config.features.userRegistration, ) && ( <> @@ -243,6 +248,15 @@ export default function Login() { } /> )} + + {config.features.userRegistration && ( + + Don't have an account?{' '} + + Register + + + )} )} diff --git a/src/components/pages/serverSettings/index.tsx b/src/components/pages/serverSettings/index.tsx index 6ce18220..df7ee941 100644 --- a/src/components/pages/serverSettings/index.tsx +++ b/src/components/pages/serverSettings/index.tsx @@ -299,10 +299,11 @@ export default function DashboardServerSettings() { {(data?.tampered?.length ?? 0) > 0 && ( } + variant='outline' > These settings are controlled by environment variables: diff --git a/src/components/pages/upload/Text/index.tsx b/src/components/pages/upload/Text/index.tsx index 494b31d0..c9c7849c 100644 --- a/src/components/pages/upload/Text/index.tsx +++ b/src/components/pages/upload/Text/index.tsx @@ -125,6 +125,7 @@ export default function UploadText() { disabled={loading} className={styles.textarea} my='sm' + resize='vertical' /> diff --git a/src/lib/client/hooks/useLogin.ts b/src/lib/client/hooks/useLogin.ts index 7231a850..77781289 100644 --- a/src/lib/client/hooks/useLogin.ts +++ b/src/lib/client/hooks/useLogin.ts @@ -2,13 +2,19 @@ import type { Response } from '@/lib/api/response'; import { isAdministrator } from '@/lib/role'; import { useEffect } from 'react'; import { redirect } from 'react-router-dom'; -import useSWR from 'swr'; +import useSWR, { SWRConfiguration } from 'swr'; import { useShallow } from 'zustand/shallow'; import { useUserStore } from '../store/user'; -export default function useLogin(administratorOnly: boolean = false) { +export default function useLogin( + { admin, swrConfig: swrOptions }: { admin?: boolean; swrConfig?: SWRConfiguration } = { + admin: false, + swrConfig: {}, + }, +) { const { data, error, isLoading, mutate } = useSWR('/api/user', { fallbackData: { user: undefined }, + ...swrOptions, }); const [user, setUser] = useUserStore(useShallow((state) => [state.user, state.setUser])); @@ -22,7 +28,7 @@ export default function useLogin(administratorOnly: boolean = false) { }, [data, error]); useEffect(() => { - if (user && administratorOnly && !isAdministrator(user.role)) { + if (user && admin && !isAdministrator(user.role)) { redirect('/dashboard'); } }, [user]);