New admin setting: open/close registrations, with custom message, from the admin UI
This commit is contained in:
parent
405c495c23
commit
5f54981846
8 changed files with 70 additions and 21 deletions
|
@ -3,7 +3,7 @@
|
|||
class Auth::RegistrationsController < Devise::RegistrationsController
|
||||
layout :determine_layout
|
||||
|
||||
before_action :check_single_user_mode
|
||||
before_action :check_enabled_registrations, only: [:new, :create]
|
||||
before_action :configure_sign_up_params, only: [:create]
|
||||
|
||||
protected
|
||||
|
@ -27,12 +27,12 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
|||
new_user_session_path
|
||||
end
|
||||
|
||||
def check_single_user_mode
|
||||
redirect_to root_path if Rails.configuration.x.single_user_mode
|
||||
def check_enabled_registrations
|
||||
redirect_to root_path if Rails.configuration.x.single_user_mode || !Setting.open_registrations
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
||||
def determine_layout
|
||||
%w(edit update).include?(action_name) ? 'admin' : 'auth'
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue