Skip to content

Commit

Permalink
feat(auth): 🛂 Disable new user signups
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed May 30, 2022
1 parent 2bdc1ce commit ff5c368
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/builder/pages/api/auth/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions apps/docs/docs/self-hosting/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Both apps have their own environment config files. Here is an exhaustive list of
| NEXTAUTH_URL | http://localhost:3000 | The builder base URL. Should be the publicly accessible URL (i.e. `https://typebot.domain.com`) |
| NEXT_PUBLIC_VIEWER_URL | http://localhost:3001 | The viewer base URL. Should be the publicly accessible URL (i.e. `https://bot.domain.com`) |
| NEXTAUTH_URL_INTERNAL | -- | The internal builder base URL. You have to set it only when `NEXTAUTH_URL` isn't publicly accessible |
| DISABLE_SIGNUP | false | To disable new sign ups but still be able to sign in with existing users or admin email |

<details><summary><h3>Email (Auth, notifications)</h3></summary>
<p>
Expand Down

5 comments on commit ff5c368

@vercel
Copy link

@vercel vercel bot commented on ff5c368 May 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on ff5c368 May 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs-git-main-typebot-io.vercel.app
docs-typebot-io.vercel.app
docs.typebot.io

@vercel
Copy link

@vercel vercel bot commented on ff5c368 May 30, 2022

@vercel
Copy link

@vercel vercel bot commented on ff5c368 May 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on ff5c368 May 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-typebot-io.vercel.app
builder-v2-git-main-typebot-io.vercel.app
app.typebot.io

Please sign in to comment.