mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-20 14:54:15 +01:00
(bug) reload config on change
This commit is contained in:
parent
48d0957bac
commit
2e406aba7f
@ -10,4 +10,14 @@ class SessionsController < Devise::SessionsController
|
||||
redirect_post "/users/auth/#{active_provider.strategy_name}"
|
||||
end
|
||||
end
|
||||
|
||||
# FIXME, Method DELETE is not allowed by Access-Control-Allow-Methods in preflight response.
|
||||
# def destroy
|
||||
# active_provider = Rails.configuration.auth_provider
|
||||
# if active_provider.providable_type == 'OpenIdConnectProvider'
|
||||
# redirect_to "/users/auth/#{active_provider.strategy_name}/logout"
|
||||
# else
|
||||
# super
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
@ -30,7 +30,7 @@ class AuthProvider < ApplicationRecord
|
||||
validates_with UserUidMappedValidator, if: -> { %w[OAuth2Provider OpenIdConnectProvider].include?(providable_type) }
|
||||
|
||||
before_create :set_initial_state
|
||||
after_update :write_config
|
||||
after_update :write_reload_config
|
||||
|
||||
def build_providable(params)
|
||||
raise "Unknown providable_type: #{providable_type}" unless PROVIDABLE_TYPES.include?(providable_type)
|
||||
@ -116,9 +116,12 @@ class AuthProvider < ApplicationRecord
|
||||
self.status = 'pending' unless AuthProvider.count.zero?
|
||||
end
|
||||
|
||||
def write_config
|
||||
def write_reload_config
|
||||
return unless status == 'active'
|
||||
|
||||
ProviderConfig.write_active_provider
|
||||
Rails.application.configure do
|
||||
config.auth_provider = ProviderConfig.new
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user