From 46c95e0da3ad27eb072efc45250abb0baf3e2483 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Sun, 23 Mar 2025 16:52:00 +0100 Subject: [PATCH] feat: auto sign-in when creating the initial user (#2664) * feat: auto sign-in on init user --- .../src/app/[locale]/init/_steps/user/init-user-form.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) 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) => {