mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: add site setting allow_new_registrations which can be used to block all new account registrations
This commit is contained in:
@@ -4,6 +4,7 @@ class InvitesController < ApplicationController
|
||||
skip_before_filter :redirect_to_login_if_required
|
||||
|
||||
before_filter :ensure_logged_in, only: [:destroy, :create, :check_csv_chunk, :upload_csv_chunk]
|
||||
before_filter :ensure_new_registrations_allowed, only: [:show, :redeem_disposable_invite]
|
||||
|
||||
def show
|
||||
invite = Invite.find_by(invite_key: params[:id])
|
||||
@@ -137,4 +138,11 @@ class InvitesController < ApplicationController
|
||||
params[:email]
|
||||
end
|
||||
|
||||
def ensure_new_registrations_allowed
|
||||
unless SiteSetting.allow_new_registrations
|
||||
flash[:error] = I18n.t('login.new_registrations_disabled')
|
||||
render layout: 'no_js'
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user