From 68d74e12fb59b543bf4751f54e89b17170dec7ea Mon Sep 17 00:00:00 2001 From: Ricki Moore Date: Tue, 11 Feb 2025 21:43:43 +0100 Subject: [PATCH] fix: remove username (#306) --- app/Main.tsx | 4 +--- src/components/AuthPrompt/AuthPrompt.tsx | 21 +-------------------- src/forms/AuthenticationForm.tsx | 9 ++------- 3 files changed, 4 insertions(+), 30 deletions(-) diff --git a/app/Main.tsx b/app/Main.tsx index b570c1ae..466a0b85 100644 --- a/app/Main.tsx +++ b/app/Main.tsx @@ -28,7 +28,6 @@ const Main = () => { const [isReady, setReady] = useState(false) const [isVersionError, setVersionError] = useState(false) const [isAuthenticated, setIsAuthenticated] = useState(false) - const [, setUsername] = useLocalStorage('username', 'Keeper') const [healthCheck] = useLocalStorage('health-check', false) const [beaconNodeVersion, setBeaconVersion] = useState('') @@ -77,10 +76,9 @@ const Main = () => { ? formatSemanticVersion(beaconNodeVersion as string) : undefined - const storeSessionCookie = async (password: string, username: string) => { + const storeSessionCookie = async (password: string) => { try { setLoading(true) - setUsername(username) const { status } = await axios.post('/api/authenticate', { password }) if (status === 200) { diff --git a/src/components/AuthPrompt/AuthPrompt.tsx b/src/components/AuthPrompt/AuthPrompt.tsx index 908677f6..307d558c 100644 --- a/src/components/AuthPrompt/AuthPrompt.tsx +++ b/src/components/AuthPrompt/AuthPrompt.tsx @@ -13,7 +13,6 @@ import Typography from '../Typography/Typography' export interface AuthModalProps extends Omit { isVisible: boolean isLoading: boolean - isNamePrompt?: boolean onClose?: () => void mode: UiMode } @@ -24,7 +23,6 @@ const AuthPrompt: FC = ({ isLoading, mode, onClose, - isNamePrompt, }) => { const { t } = useTranslation() const [isReady, setReady] = useState(false) @@ -58,23 +56,6 @@ const AuthPrompt: FC = ({
- {isNamePrompt && ( - ( - - )} - /> - )} = ({ isAutoFocus tooltip={t('authPrompt.tooltip.sessionPassword')} toolTipId='sessionPassword' - label={isNamePrompt ? t('authPrompt.label.sessionPassword') : undefined} + label={t('authPrompt.label.sessionPassword')} autoComplete='new-password' type='password' uiMode={mode} diff --git a/src/forms/AuthenticationForm.tsx b/src/forms/AuthenticationForm.tsx index c8c81cf1..2cc7ab8e 100644 --- a/src/forms/AuthenticationForm.tsx +++ b/src/forms/AuthenticationForm.tsx @@ -1,15 +1,13 @@ import { FC, FormEvent, ReactElement, useEffect } from 'react' import { Control, useForm } from 'react-hook-form' -import useLocalStorage from '../hooks/useLocalStorage' export interface AuthFormProps { children: (props: RenderProps) => ReactElement - onSubmit: (token: string, username: string) => void + onSubmit: (token: string) => void isVisible: boolean } export interface AuthForm { - username: string password: string } @@ -19,11 +17,9 @@ export interface RenderProps { } const AuthenticationForm: FC = ({ children, onSubmit, isVisible }) => { - const [username] = useLocalStorage('username', 'Keeper') const { control, watch, reset } = useForm({ defaultValues: { - username, password: '', }, mode: 'onChange', @@ -36,12 +32,11 @@ const AuthenticationForm: FC = ({ children, onSubmit, isVisible } }, [isVisible, reset]) const password = watch('password') - const name = watch('username') const submitForm = (e: FormEvent) => { e.preventDefault() if (password) { - onSubmit(password, name) + onSubmit(password) } }