Skip to content

Commit

Permalink
Created an ENV variable for controlling USER registrations on Vulcan …
Browse files Browse the repository at this point in the history
…app (Enabled by Default) (#535)

Created an ENV variable for controlling USER registrations on Vulcan app (Enabled by Default

Co-authored-by: Sai Pavan Marlakunta <smarlakunta@vmware.com>
  • Loading branch information
smarlaku820 and Sai Pavan Marlakunta committed Feb 8, 2023
1 parent 526ae8b commit faa8f0f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/helpers/sessions_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/views/devise/sessions/new.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 3 additions & 0 deletions config/initializers/0_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down
2 changes: 2 additions & 0 deletions config/vulcan.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
Expand Down

0 comments on commit faa8f0f

Please sign in to comment.