FEATURE: add site setting allow_new_registrations which can be used to block all new account registrations

This commit is contained in:
Neil Lalonde
2014-07-14 15:42:14 -04:00
parent ac3827f700
commit 766196af87
8 changed files with 57 additions and 1 deletions

View File

@@ -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