Add student profile page with password change
- New page /profile: shows name/email and password change form - Uses authClient.changePassword (current + new + confirm) - Student name in header is now a link to /profile Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { headers } from "next/headers";
|
||||
import { auth } from "@/lib/auth";
|
||||
import { redirect } from "next/navigation";
|
||||
import { ChangePasswordForm } from "./change-password-form";
|
||||
|
||||
export const metadata = { title: "Профиль" };
|
||||
|
||||
export default async function ProfilePage() {
|
||||
const session = await auth.api.getSession({ headers: await headers() });
|
||||
if (!session) redirect("/login");
|
||||
|
||||
return (
|
||||
<main className="max-w-lg mx-auto px-4 py-10 w-full">
|
||||
<h1 className="text-xl font-bold tracking-wide mb-8" style={{ color: "var(--foreground)" }}>
|
||||
Профиль
|
||||
</h1>
|
||||
|
||||
<div className="card-aubade p-6 mb-6">
|
||||
<h2 className="text-xs uppercase tracking-widest font-bold mb-4" style={{ color: "var(--muted-foreground)" }}>
|
||||
Аккаунт
|
||||
</h2>
|
||||
<div className="space-y-3 text-sm" style={{ color: "var(--foreground)" }}>
|
||||
<div className="flex justify-between">
|
||||
<span style={{ color: "var(--muted-foreground)" }}>Имя</span>
|
||||
<span>{session.user.name}</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span style={{ color: "var(--muted-foreground)" }}>Email</span>
|
||||
<span>{session.user.email}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="card-aubade p-6">
|
||||
<h2 className="text-xs uppercase tracking-widest font-bold mb-4" style={{ color: "var(--muted-foreground)" }}>
|
||||
Смена пароля
|
||||
</h2>
|
||||
<ChangePasswordForm />
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user