diff --git a/src/pages/onboard.tsx b/src/pages/onboard.tsx
index 02e8bf363..18a579ad6 100644
--- a/src/pages/onboard.tsx
+++ b/src/pages/onboard.tsx
@@ -21,6 +21,8 @@ import { useMediaQuery } from '@mantine/hooks';
import { IconLayoutDashboard, IconUserCog } from '@tabler/icons-react';
import { IconArrowRight, IconBook2, IconUserPlus } from '@tabler/icons-react';
import { GetServerSideProps } from 'next';
+import { signIn } from 'next-auth/react';
+import Head from 'next/head';
import Link from 'next/link';
import { ReactNode, useMemo, useState } from 'react';
import { z } from 'zod';
@@ -42,26 +44,32 @@ export default function OnboardPage() {
const background = colorScheme === 'dark' ? 'dark.6' : 'gray.1';
return (
-
-
-
-
+ <>
+
+ Onboard • Homarr
+
+
+
+
+
+
+
-
-
-
- {stepContents.map((_, index) => (
-
- ))}
-
-
+
+
+ {stepContents.map((_, index) => (
+
+ ))}
+
+
+
-
+ >
);
}
@@ -101,7 +109,8 @@ const FirstStepContent: StepContentComponent = ({ isMobile, next }) => {
};
const SecondStepContent: StepContentComponent = ({ isMobile, next }) => {
- const { mutateAsync, isLoading } = api.user.createAdminAccount.useMutation();
+ const [isSigninIn, setIsSigninIn] = useState(false);
+ const { mutateAsync } = api.user.createAdminAccount.useMutation();
const { i18nZodResolver } = useI18nZodResolver();
const form = useForm>({
@@ -109,9 +118,21 @@ const SecondStepContent: StepContentComponent = ({ isMobile, next }) => {
validateInputOnBlur: true,
});
const handleSubmit = (values: z.infer) => {
+ setIsSigninIn(true);
void mutateAsync(values, {
onSuccess: () => {
- next();
+ signIn('credentials', {
+ redirect: false,
+ name: values.username,
+ password: values.password,
+ callbackUrl: '/',
+ }).then((response) => {
+ if (!response?.ok) {
+ setIsSigninIn(false);
+ return;
+ }
+ next();
+ });
},
});
};
@@ -147,7 +168,7 @@ const SecondStepContent: StepContentComponent = ({ isMobile, next }) => {
withAsterisk
{...form.getInputProps('passwordConfirmation')}
/>
-