feat: check NEXT_PUBLIC_ENABLE_REGISTER in /api/register

This commit is contained in:
shinya
2025-07-02 23:48:37 +08:00
parent 373268a83b
commit b941628986
2 changed files with 12 additions and 3 deletions

View File

@@ -20,6 +20,11 @@ export async function POST(req: NextRequest) {
);
}
// 校验是否开放注册
if (process.env.NEXT_PUBLIC_ENABLE_REGISTER !== 'true') {
return NextResponse.json({ error: '当前未开放注册' }, { status: 400 });
}
const { username, password } = await req.json();
if (!username || typeof username !== 'string') {