Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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