Chore: Making Account Signup Optional (#563)
Introduce new environment variable that lets you control account signups ENABLE_ACCOUNT_SIGNUP :( true | false | api_only ) Fixes: #406 Co-authored-by: Pranav Raj S <pranavrajs@gmail.com>
This commit is contained in:
parent
0aad99ff0b
commit
b05f843790
7 changed files with 92 additions and 15 deletions
|
@ -4,6 +4,7 @@ class Api::V1::AccountsController < Api::BaseController
|
|||
skip_before_action :verify_authenticity_token, only: [:create]
|
||||
skip_before_action :authenticate_user!, :set_current_user, :check_subscription, :handle_with_exception,
|
||||
only: [:create], raise: false
|
||||
before_action :check_signup_enabled
|
||||
|
||||
rescue_from CustomExceptions::Account::InvalidEmail,
|
||||
CustomExceptions::Account::UserExists,
|
||||
|
@ -30,4 +31,8 @@ class Api::V1::AccountsController < Api::BaseController
|
|||
def account_params
|
||||
params.permit(:account_name, :email)
|
||||
end
|
||||
|
||||
def check_signup_enabled
|
||||
raise ActionController::RoutingError, 'Not Found' if ENV.fetch('ENABLE_ACCOUNT_SIGNUP', true) == 'false'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue