diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb index 96b330ab..2bf01813 100644 --- a/app/helpers/sessions_helper.rb +++ b/app/helpers/sessions_helper.rb @@ -16,6 +16,10 @@ def local_login_enabled? Settings.local_login.enabled end + def user_registration_enabled? + Settings.user_registration.enabled + end + def non_ldap_oauth_providers resource_class.omniauth_providers.reject { |p| p.eql?(:ldap) } end diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 70de3316..2b863db0 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -21,6 +21,7 @@ %b-tab{:active => params[:active_tab].eql?('local') ? true : false, :title => "Local Login"} %b-card-text = render 'devise/sessions/local' + - if user_registration_enabled? %b-tab{:active => params[:active_tab].eql?('registration') ? true : false, :title => "Register"} %b-card-text = render 'devise/registrations/form' diff --git a/config/initializers/0_settings.rb b/config/initializers/0_settings.rb index f56f1c61..c31628f6 100644 --- a/config/initializers/0_settings.rb +++ b/config/initializers/0_settings.rb @@ -11,6 +11,9 @@ Settings['local_login'] ||= Settingslogic.new({}) Settings.local_login['enabled'] = false if Settings.local_login['enabled'].nil? +Settings['user_registration'] ||= Settingslogic.new({}) +Settings.user_registration['enabled'] = false if Settings.user_registration['enabled'].nil? + Settings['smtp'] ||= Settingslogic.new({}) Settings.smtp['enabled'] = false if Settings.smtp['enabled'].nil? diff --git a/config/vulcan.default.yml b/config/vulcan.default.yml index baeb44fb..1798c449 100644 --- a/config/vulcan.default.yml +++ b/config/vulcan.default.yml @@ -26,6 +26,8 @@ defaults: &defaults enabled: <%= ENV['VULCAN_ENABLE_LOCAL_LOGIN'] || true %> email_confirmation: <%= ENV['VULCAN_ENABLE_EMAIL_CONFIRMATION'] || false %> session_timeout: <%= ENV['VULCAN_SESSION_TIMEOUT'] || 60 %> + user_registration: + enabled: <%= ENV['VULCAN_ENABLE_USER_REGISTRATION'] || true %> ldap: enabled: <%= ENV['VULCAN_ENABLE_LDAP'] || false %> servers: diff --git a/docs/config.md b/docs/config.md index f1cae2e4..fa39f338 100644 --- a/docs/config.md +++ b/docs/config.md @@ -37,6 +37,9 @@ Vulcan can be set up in a few different ways. It can be done by having a vulcan. - **email_confirmation:** Turns on email confirmation for local registration. `(ENV: VULCAN_ENABLE_EMAIL_CONFIRMATION)(default: false)` - **session_timeout:** Automatically logs user out after a period of time of inactivity in minutes. `(ENV: VULCAN_SESSION_TIMEOUT)(default: 60)` +## Configure User Registration +- **enabled:** Allows users to register themselves on the Vulcan app. `(ENV: VULCAN_ENABLE_USER_REGISTRATION)(default: true)` + ## Configure LDAP - **enabled:** `(ENV: ENABLE_LDAP)(default: false)`