diff --git a/backend/src/share/share.service.ts b/backend/src/share/share.service.ts index 321e155..4a46c28 100644 --- a/backend/src/share/share.service.ts +++ b/backend/src/share/share.service.ts @@ -278,7 +278,7 @@ export class ShareService { share?.security?.password && !(await argon.verify(share.security.password, password)) ) { - throw new ForbiddenException("Wrong password"); + throw new ForbiddenException("Wrong password", "wrong_password"); } if (share.security?.maxViews && share.security.maxViews <= share.views) { diff --git a/frontend/src/components/account/showEnableTotpModal.tsx b/frontend/src/components/account/showEnableTotpModal.tsx index 4bacaa5..2073236 100644 --- a/frontend/src/components/account/showEnableTotpModal.tsx +++ b/frontend/src/components/account/showEnableTotpModal.tsx @@ -7,7 +7,6 @@ import { Stack, Text, TextInput, - Title, Tooltip, } from "@mantine/core"; import { useForm, yupResolver } from "@mantine/form"; @@ -27,7 +26,7 @@ const showEnableTotpModal = ( } ) => { return modals.openModal({ - title: Enable TOTP, + title: "Enable TOTP", children: ( ), diff --git a/frontend/src/components/admin/users/showCreateUserModal.tsx b/frontend/src/components/admin/users/showCreateUserModal.tsx index 727b0a3..cf6a094 100644 --- a/frontend/src/components/admin/users/showCreateUserModal.tsx +++ b/frontend/src/components/admin/users/showCreateUserModal.tsx @@ -5,7 +5,6 @@ import { Stack, Switch, TextInput, - Title, } from "@mantine/core"; import { useForm, yupResolver } from "@mantine/form"; import { ModalsContextProps } from "@mantine/modals/lib/context"; @@ -19,7 +18,7 @@ const showCreateUserModal = ( getUsers: () => void ) => { return modals.openModal({ - title: Create user, + title: "Create user", children: ( ), diff --git a/frontend/src/components/admin/users/showUpdateUserModal.tsx b/frontend/src/components/admin/users/showUpdateUserModal.tsx index c15338e..c3a2432 100644 --- a/frontend/src/components/admin/users/showUpdateUserModal.tsx +++ b/frontend/src/components/admin/users/showUpdateUserModal.tsx @@ -6,7 +6,6 @@ import { Stack, Switch, TextInput, - Title, } from "@mantine/core"; import { useForm, yupResolver } from "@mantine/form"; import { ModalsContextProps } from "@mantine/modals/lib/context"; @@ -21,7 +20,7 @@ const showUpdateUserModal = ( getUsers: () => void ) => { return modals.openModal({ - title: Update {user.username}, + title: `Update ${user.username}`, children: , }); }; diff --git a/frontend/src/components/share/modals/showCompletedReverseShareModal.tsx b/frontend/src/components/share/modals/showCompletedReverseShareModal.tsx index b79565b..54a872a 100644 --- a/frontend/src/components/share/modals/showCompletedReverseShareModal.tsx +++ b/frontend/src/components/share/modals/showCompletedReverseShareModal.tsx @@ -1,4 +1,4 @@ -import { ActionIcon, Button, Stack, TextInput, Title } from "@mantine/core"; +import { ActionIcon, Button, Stack, TextInput } from "@mantine/core"; import { useClipboard } from "@mantine/hooks"; import { useModals } from "@mantine/modals"; import { ModalsContextProps } from "@mantine/modals/lib/context"; @@ -14,11 +14,7 @@ const showCompletedReverseShareModal = ( closeOnClickOutside: false, withCloseButton: false, closeOnEscape: false, - title: ( - - Reverse share link - - ), + title: "Reverse share link", children: , }); }; diff --git a/frontend/src/components/share/modals/showCreateReverseShareModal.tsx b/frontend/src/components/share/modals/showCreateReverseShareModal.tsx index 0c00b86..590df22 100644 --- a/frontend/src/components/share/modals/showCreateReverseShareModal.tsx +++ b/frontend/src/components/share/modals/showCreateReverseShareModal.tsx @@ -8,7 +8,6 @@ import { Stack, Switch, Text, - Title, } from "@mantine/core"; import { useForm } from "@mantine/form"; import { useModals } from "@mantine/modals"; @@ -25,7 +24,7 @@ const showCreateReverseShareModal = ( getReverseShares: () => void ) => { return modals.openModal({ - title: Create reverse share, + title: "Create reverse share", children: ( Promise ) => { return modals.openModal({ closeOnClickOutside: false, withCloseButton: false, closeOnEscape: false, - title: ( - <> - Password required - - This access this share please enter the password for the share. - - - ), + title: "Password required", children: , }); }; -const Body = ({ submitCallback }: { submitCallback: any }) => { +const Body = ({ + submitCallback, +}: { + submitCallback: (password: string) => Promise; +}) => { const [password, setPassword] = useState(""); const [passwordWrong, setPasswordWrong] = useState(false); return ( - <> - - setPasswordWrong(false)} - onChange={(e) => setPassword(e.target.value)} - value={password} - /> - - - + + + This access this share please enter the password for the share. + + +
{ + e.preventDefault(); + submitCallback(password); + }} + > + + setPasswordWrong(false)} + onChange={(e) => setPassword(e.target.value)} + value={password} + /> + + +
+
); }; diff --git a/frontend/src/components/share/showErrorModal.tsx b/frontend/src/components/share/showErrorModal.tsx index c0c2783..72f0171 100644 --- a/frontend/src/components/share/showErrorModal.tsx +++ b/frontend/src/components/share/showErrorModal.tsx @@ -1,4 +1,4 @@ -import { Button, Stack, Text, Title } from "@mantine/core"; +import { Button, Stack, Text } from "@mantine/core"; import { useModals } from "@mantine/modals"; import { ModalsContextProps } from "@mantine/modals/lib/context"; import { useRouter } from "next/router"; @@ -12,7 +12,7 @@ const showErrorModal = ( closeOnClickOutside: false, withCloseButton: false, closeOnEscape: false, - title: {title}, + title: title, children: , }); diff --git a/frontend/src/components/upload/modals/showCompletedUploadModal.tsx b/frontend/src/components/upload/modals/showCompletedUploadModal.tsx index a03ed9e..43c5fd1 100644 --- a/frontend/src/components/upload/modals/showCompletedUploadModal.tsx +++ b/frontend/src/components/upload/modals/showCompletedUploadModal.tsx @@ -1,11 +1,4 @@ -import { - ActionIcon, - Button, - Stack, - Text, - TextInput, - Title, -} from "@mantine/core"; +import { ActionIcon, Button, Stack, Text, TextInput } from "@mantine/core"; import { useClipboard } from "@mantine/hooks"; import { useModals } from "@mantine/modals"; import { ModalsContextProps } from "@mantine/modals/lib/context"; @@ -24,11 +17,7 @@ const showCompletedUploadModal = ( closeOnClickOutside: false, withCloseButton: false, closeOnEscape: false, - title: ( - - Share ready - - ), + title: "Share ready", children: , }); }; diff --git a/frontend/src/components/upload/modals/showCreateUploadModal.tsx b/frontend/src/components/upload/modals/showCreateUploadModal.tsx index 41315ab..c9f5901 100644 --- a/frontend/src/components/upload/modals/showCreateUploadModal.tsx +++ b/frontend/src/components/upload/modals/showCreateUploadModal.tsx @@ -37,7 +37,7 @@ const showCreateUploadModal = ( uploadCallback: (createShare: CreateShare) => void ) => { return modals.openModal({ - title: Share, + title: "Share", children: ( { getFiles(); }) .catch((e) => { - if (e.response.data.error == "share_max_views_exceeded") { + const { error } = e.response.data; + if (error == "share_max_views_exceeded") { showErrorModal( modals, "Visitor limit exceeded", "The visitor limit from this share has been exceeded." ); + } else { + toast.axiosError(e); } }); }; diff --git a/frontend/src/styles/mantine.style.ts b/frontend/src/styles/mantine.style.ts index 510c7d3..005c21b 100644 --- a/frontend/src/styles/mantine.style.ts +++ b/frontend/src/styles/mantine.style.ts @@ -16,4 +16,14 @@ export default { ], }, primaryColor: "victoria", + components: { + Modal: { + styles: (theme) => ({ + title: { + fontSize: theme.fontSizes.lg, + fontWeight: 700, + }, + }), + }, + }, };