mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-30 20:23:14 +08:00
Merge pull request #464 from okriuchykhin/ok_SCI_935
Add config option to enable/disable users registration [SCI-935]
This commit is contained in:
commit
067b9452a4
5 changed files with 18 additions and 1 deletions
|
@ -122,7 +122,13 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
|||
end
|
||||
end
|
||||
|
||||
def new
|
||||
render_403 && return unless Rails.configuration.x.enable_user_registration
|
||||
end
|
||||
|
||||
def create
|
||||
render_403 && return unless Rails.configuration.x.enable_user_registration
|
||||
|
||||
build_resource(sign_up_params)
|
||||
valid_resource = resource.valid?
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<%= link_to t("devise.links.login"), new_session_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
||||
<%- if devise_mapping.registerable? && Rails.configuration.x.enable_user_registration && controller_name != 'registrations' %>
|
||||
<%= link_to t("devise.links.signup"), new_registration_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
|
|
|
@ -75,4 +75,8 @@ Rails.application.configure do
|
|||
# Enable email confirmations
|
||||
config.x.enable_email_confirmations =
|
||||
ENV['ENABLE_EMAIL_CONFIRMATIONS'] == 'true'
|
||||
|
||||
# Enable user registrations
|
||||
config.x.enable_user_registration =
|
||||
ENV['ENABLE_USER_REGISTRATION'] == 'false' ? false : true
|
||||
end
|
||||
|
|
|
@ -108,4 +108,8 @@ Rails.application.configure do
|
|||
# Enable email confirmations
|
||||
config.x.enable_email_confirmations =
|
||||
ENV['ENABLE_EMAIL_CONFIRMATIONS'] == 'true'
|
||||
|
||||
# Enable user registrations
|
||||
config.x.enable_user_registration =
|
||||
ENV['ENABLE_USER_REGISTRATION'] == 'false' ? false : true
|
||||
end
|
||||
|
|
|
@ -74,4 +74,7 @@ Rails.application.configure do
|
|||
|
||||
# Enable email confirmations
|
||||
config.x.enable_email_confirmations = false
|
||||
|
||||
# Enable user registrations
|
||||
config.x.enable_user_registration = true
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue