mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-19 10:07:24 +00:00
fix: fix the login container; fix the incorrect input of captcha enter trigger (#5327)
This commit is contained in:
@@ -32,6 +32,20 @@ const SendCodeAuthModal = ({
|
|||||||
runAsync: getCaptcha
|
runAsync: getCaptcha
|
||||||
} = useRequest2(() => getCaptchaPic(username), { manual: false });
|
} = useRequest2(() => getCaptchaPic(username), { manual: false });
|
||||||
|
|
||||||
|
const onSubmit = async ({ code }: { code: string }) => {
|
||||||
|
await onSendCode({ username, captcha: code });
|
||||||
|
onClose();
|
||||||
|
};
|
||||||
|
|
||||||
|
const onError = (err: any) => {
|
||||||
|
console.log(err);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleEnterKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
|
if (e.key.toLowerCase() !== 'enter') return;
|
||||||
|
handleSubmit(onSubmit, onError)();
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MyModal isOpen={true}>
|
<MyModal isOpen={true}>
|
||||||
<ModalBody pt={8}>
|
<ModalBody pt={8}>
|
||||||
@@ -55,25 +69,17 @@ const SendCodeAuthModal = ({
|
|||||||
/>
|
/>
|
||||||
</Skeleton>
|
</Skeleton>
|
||||||
|
|
||||||
<Input placeholder={t('common:support.user.captcha_placeholder')} {...register('code')} />
|
<Input
|
||||||
|
placeholder={t('common:support.user.captcha_placeholder')}
|
||||||
|
{...register('code')}
|
||||||
|
onKeyDown={handleEnterKeyDown}
|
||||||
|
/>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
<ModalFooter gap={2}>
|
<ModalFooter gap={2}>
|
||||||
<Button isLoading={onSending} variant={'whiteBase'} onClick={onClose}>
|
<Button isLoading={onSending} variant={'whiteBase'} onClick={onClose}>
|
||||||
{t('common:Cancel')}
|
{t('common:Cancel')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button isLoading={onSending} onClick={handleSubmit(onSubmit, onError)}>
|
||||||
isLoading={onSending}
|
|
||||||
onClick={handleSubmit(
|
|
||||||
({ code }) => {
|
|
||||||
return onSendCode({ username, captcha: code }).then(() => {
|
|
||||||
onClose();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
(err) => {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{t('common:Confirm')}
|
{t('common:Confirm')}
|
||||||
</Button>
|
</Button>
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
|
@@ -23,7 +23,7 @@ const LoginModal = ({ onSuccess }: LoginModalProps) => {
|
|||||||
maxW="556px"
|
maxW="556px"
|
||||||
maxH={['100vh', '90vh']}
|
maxH={['100vh', '90vh']}
|
||||||
borderRadius={[0, '16px']}
|
borderRadius={[0, '16px']}
|
||||||
overflow="auto"
|
overflow="hidden"
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
px={['5vw', '88px']}
|
px={['5vw', '88px']}
|
||||||
|
@@ -242,9 +242,9 @@ export const LoginContainer = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Box position="relative" w="full" h="full">
|
<Box position="relative" w="full" flex={'1 0 0'}>
|
||||||
{/* main content area */}
|
{/* main content area */}
|
||||||
<Box w={['100%', '380px']} minH={['100vh', '600px']} flex={'1 0 0'}>
|
<Box w={['100%', '380px']} flex={'1 0 0'}>
|
||||||
{pageType && DynamicComponent ? DynamicComponent : <Loading fixed={false} />}
|
{pageType && DynamicComponent ? DynamicComponent : <Loading fixed={false} />}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user