feat(api): add user info GET endpoint and blocklist usernames
This commit is contained in:
parent
c5ca2d56ac
commit
6c9569ae40
5 changed files with 110 additions and 4 deletions
|
@ -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',
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue