Add register + logout auth flows, and batch-5 resources
Auth (hand-built, uses the auth core): - /register + register() action: validates, hashes with argon2id (hashPassword), creates an emulator-compatible users row (accountCreated/ipRegister/ipCurrent/ look), redirect kept outside try so NEXT_REDIRECT propagates. Login/register cross-links; header shows Register (logged-out) and a Logout (signOut) button. Batch 5 (parallel agents): /admin/rooms (+[id]) search+detail, /admin/vouchers (CRUD), /admin/subscriptions (read), /admin/calendar (campaigns+rewards read), /marketplace (public). Header + admin nav extended. Verified: tsc exit 0, vitest 48/48, next build exit 0 (52 page routes).
This commit is contained in:
1 parent
e8be0461d8
commit
08a9882be8
13 files changed
+1001
-4
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import Link from "next/link";
|
||||
import { auth } from "@/lib/auth";
|
||||
import { auth, signOut } from "@/lib/auth";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { siteSettings } from "@/lib/services/site-settings";
|
||||
|
||||
@@ -48,6 +48,9 @@ export async function SiteHeader() {
|
||||
<Link className="nav-item" href="/shop">
|
||||
Shop
|
||||
</Link>
|
||||
<Link className="nav-item" href="/marketplace">
|
||||
Market
|
||||
</Link>
|
||||
<Link className="nav-item" href="/community">
|
||||
Community
|
||||
</Link>
|
||||
@@ -103,11 +106,26 @@ export async function SiteHeader() {
|
||||
<Link className="nav-item" href={`/u/${session.user.name}`}>
|
||||
{session.user.name}
|
||||
</Link>
|
||||
<form
|
||||
action={async () => {
|
||||
"use server";
|
||||
await signOut({ redirectTo: "/" });
|
||||
}}
|
||||
>
|
||||
<button type="submit" className="btn btn-outline">
|
||||
Logout
|
||||
</button>
|
||||
</form>
|
||||
</>
|
||||
) : (
|
||||
<Link className="btn btn-outline" href="/login">
|
||||
Login
|
||||
</Link>
|
||||
<>
|
||||
<Link className="nav-item" href="/register">
|
||||
Register
|
||||
</Link>
|
||||
<Link className="btn btn-outline" href="/login">
|
||||
Login
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
Reference in new issue
Block a user