Add player controls and configurable profiles
This commit is contained in:
@@ -5,6 +5,7 @@ import { redirect } from "next/navigation";
|
||||
import { Prisma, type User } from "@prisma/client";
|
||||
import { prisma } from "./prisma";
|
||||
import { clearSession, setSession } from "./session";
|
||||
import { getAppSettings } from "./settings";
|
||||
|
||||
function normalizeUsername(value: FormDataEntryValue | null) {
|
||||
return String(value || "")
|
||||
@@ -14,6 +15,11 @@ function normalizeUsername(value: FormDataEntryValue | null) {
|
||||
}
|
||||
|
||||
export async function registerUser(formData: FormData) {
|
||||
const settings = await getAppSettings();
|
||||
if (settings.registrationMode !== "OPEN") {
|
||||
redirect("/register?error=closed");
|
||||
}
|
||||
|
||||
const username = normalizeUsername(formData.get("username"));
|
||||
const password = String(formData.get("password") || "");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user