feat(api): add user info GET endpoint and blocklist usernames

This commit is contained in:
Dominik 2025-06-12 19:00:57 +02:00
parent c5ca2d56ac
commit 6c9569ae40
Signed by: dominik
GPG key ID: 06A4003FC5049644
5 changed files with 110 additions and 4 deletions

View file

@ -2,7 +2,7 @@
import type { z } from 'zod';
import bcrypt from 'bcryptjs';
import { registerSchema } from '@/lib/validation/user';
import { disallowedUsernames, registerSchema } from '@/lib/validation/user';
import { prisma } from '@/prisma';
export async function registerAction(data: z.infer<typeof registerSchema>) {
@ -35,7 +35,7 @@ export async function registerAction(data: z.infer<typeof registerSchema>) {
},
});
if (existingUsername) {
if (existingUsername || disallowedUsernames.includes(username.toLowerCase())) {
return {
error: 'Username already exists',
};