Add name change functionality to user settings. Update SettingsPasswordForm to handle name updates, including validation and error handling. Fetch current user name for display in settings page.
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m44s

This commit is contained in:
Julien Froidefond
2026-02-20 14:47:32 +01:00
parent 8073321b0f
commit 160e90fbde
5 changed files with 170 additions and 6 deletions

View File

@@ -1,10 +1,16 @@
import { redirect } from "next/navigation";
import { auth } from "@/auth";
import { prisma } from "@/lib/db";
import { SettingsPasswordForm } from "@/components/SettingsPasswordForm";
export default async function SettingsPage() {
const session = await auth();
if (!session?.user) redirect("/auth/login");
if (!session?.user?.id) redirect("/auth/login");
return <SettingsPasswordForm />;
const user = await prisma.user.findUnique({
where: { id: session.user.id },
select: { name: true },
});
return <SettingsPasswordForm currentName={user?.name ?? ""} />;
}