mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 13:37:28 +00:00
Feature: Option to disable use signups using env
This commit is contained in:
parent
c9ace3d1e7
commit
463f147ccd
2 changed files with 14 additions and 6 deletions
|
|
@ -13,3 +13,6 @@ SMTP_USERNAME=
|
|||
SMTP_PASSWORD=
|
||||
SMTP_DOMAIN=
|
||||
SMTP_ADDRESS=
|
||||
|
||||
# DISABLE USER SIGNUPS (true or false)
|
||||
DISABLE_SIGNUPS=
|
||||
|
|
|
|||
|
|
@ -14,13 +14,18 @@ class AuthenticationController < ApplicationController
|
|||
end
|
||||
|
||||
def signup
|
||||
email = params[:email]
|
||||
password = SecureRandom.uuid
|
||||
org = Organization.create(name: 'new org')
|
||||
user = User.create(email: email, password: password, organization: org)
|
||||
# Check if the installation allows user signups
|
||||
if(ENV['DISABLE_SIGNUPS'] === "true")
|
||||
render json: {}, status: 500
|
||||
else
|
||||
email = params[:email]
|
||||
password = SecureRandom.uuid
|
||||
org = Organization.create(name: 'new org')
|
||||
user = User.create(email: email, password: password, organization: org)
|
||||
|
||||
org_user = OrganizationUser.create(user: user, organization: org, role: 'admin')
|
||||
org_user = OrganizationUser.create(user: user, organization: org, role: 'admin')
|
||||
|
||||
UserMailer.with(user: user, sender: @current_user).new_signup_email.deliver if org_user.save
|
||||
UserMailer.with(user: user, sender: @current_user).new_signup_email.deliver if org_user.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue