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

* feat: auto sign-in on init user
This commit is contained in:
Thomas Camlong
2025-03-23 16:52:00 +01:00
committed by GitHub
parent 0aacbe95c2
commit 46c95e0da3

View File

@@ -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) => {