Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

feat: auto sign-in when creating the initial user (#2664)

Thomas Camlong46c95e0da3ad
diff --git a/apps/nextjs/src/app/[locale]/init/_steps/user/init-user-form.tsx b/apps/nextjs/src/app/[locale]/init/_steps/user/init-user-form.tsx
index e094ce4ce..2dd2df722 100644
--- a/apps/nextjs/src/app/[locale]/init/_steps/user/init-user-form.tsx
+++ b/apps/nextjs/src/app/[locale]/init/_steps/user/init-user-form.tsx
@@ -4,6 +4,7 @@ import { Button, PasswordInput, Stack, TextInput } from "@mantine/core";
import type { z } from "zod";
import { clientApi } from "@homarr/api/client";
+import { signIn } from "@homarr/auth/client";
import { revalidatePathActionAsync } from "@homarr/common/client";
import { useZodForm } from "@homarr/form";
import { showErrorNotification, showSuccessNotification } from "@homarr/notifications";
@@ -30,6 +31,13 @@ export const InitUserForm = () => {
title: tUser("notification.success.title"),
message: tUser("notification.success.message"),
});
+
+ await signIn("credentials", {
+ name: values.username,
+ password: values.password,
+ redirect: false,
+ });
+
await revalidatePathActionAsync("/init");
},
onError: (error) => {