diff --git a/next-env.d.ts b/next-env.d.ts index fd36f9494..4f11a03dc 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,6 +1,5 @@ /// /// -/// // NOTE: This file should not be edited // see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/public/locales/en/authentication/invite.json b/public/locales/en/authentication/invite.json index 2554a5472..416629e88 100644 --- a/public/locales/en/authentication/invite.json +++ b/public/locales/en/authentication/invite.json @@ -29,7 +29,7 @@ }, "error": { "title": "Error", - "text": "Something went wrong" + "text": "Something went wrong, got the following error: {{error}}" } } } \ No newline at end of file diff --git a/src/components/layout/Background/FloatingBackground.tsx b/src/components/layout/Background/FloatingBackground.tsx index 83ccc4353..59140e6c1 100644 --- a/src/components/layout/Background/FloatingBackground.tsx +++ b/src/components/layout/Background/FloatingBackground.tsx @@ -1,5 +1,5 @@ import { Box, createStyles, useMantineTheme } from '@mantine/core'; -import { useMouse, useViewportSize } from '@mantine/hooks'; +import { useMouse } from '@mantine/hooks'; import { PolkaElement } from './PolkaElement'; @@ -12,6 +12,7 @@ export const FloatingBackground = () => { + ); @@ -19,9 +20,7 @@ export const FloatingBackground = () => { const MouseBackdrop = () => { const { x, y } = useMouse(); - const { width, height } = useViewportSize(); - const smaller = Math.min(width, height); - const radius = Math.max(smaller - 500, 200); + const radius = 40; return ( >({ validateInputOnChange: true, validateInputOnBlur: true, validate: i18nZodResolver(signUpFormSchema), + initialValues: { + username: '', + password: '', + passwordConfirmation: '', + }, }); const handleSubmit = (values: z.infer) => { @@ -68,11 +85,11 @@ export default function AuthInvitePage() { router.push('/manage'); }); }, - onError() { + onError(error) { updateNotification({ id: notificationId, title: t('notifications.error.title'), - message: t('notifications.error.text'), + message: t('notifications.error.text', { error: error.message }), color: 'red', icon: , }); @@ -90,6 +107,7 @@ export default function AuthInvitePage() { + {t('title')} @@ -107,13 +125,20 @@ export default function AuthInvitePage() { withAsterisk {...form.getInputProps('username')} /> - <PasswordInput variant="filled" label={t('form.fields.password.label')} withAsterisk {...form.getInputProps('password')} /> + <Card + withBorder + style={{ + display: form.isValid('password') ? 'none' : 'block', + }} + > + <PasswordRequirements value={form.values.password} /> + </Card> <PasswordInput variant="filled" @@ -122,7 +147,7 @@ export default function AuthInvitePage() { {...form.getInputProps('passwordConfirmation')} /> - <Button fullWidth type="submit" loading={isLoading}> + <Button fullWidth type="submit" disabled={!form.isValid()} loading={isLoading}> {t('form.buttons.submit')} </Button> </Stack> @@ -182,7 +207,12 @@ export const getServerSideProps: GetServerSideProps = async ({ return { props: { - ...(await getServerSideTranslations(['authentication/invite'], locale, req, res)), + ...(await getServerSideTranslations( + ['authentication/invite', 'password-requirements'], + locale, + req, + res + )), }, }; };