2
0

feat(auth): 🛂 Disable new user signups

This commit is contained in:
Baptiste Arnaud
2022-05-30 17:08:00 +02:00
parent 2bdc1ce056
commit ff5c3683fc
2 changed files with 6 additions and 0 deletions

View File

@ -29,6 +29,11 @@ export function CustomAdapter(p: PrismaClient): Adapter {
const workspaceInvitations = await p.workspaceInvitation.findMany({
where: { email: user.email },
})
if (
process.env.DISABLE_SIGNUP === 'true' &&
process.env.ADMIN_EMAIL !== data.email
)
throw Error('New users are forbidden')
const createdUser = await p.user.create({
data: {
...data,