mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
Merge pull request #538 from luckyPipewrench/sso-upgrades
Multi-provider SSO with admin UI and SAML support
This commit is contained in:
@@ -6,5 +6,6 @@ class Settings::SecuritiesController < ApplicationController
|
||||
[ "Home", root_path ],
|
||||
[ "Security", nil ]
|
||||
]
|
||||
@oidc_identities = Current.user.oidc_identities.order(:provider)
|
||||
end
|
||||
end
|
||||
|
||||
27
app/controllers/settings/sso_identities_controller.rb
Normal file
27
app/controllers/settings/sso_identities_controller.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Settings::SsoIdentitiesController < ApplicationController
|
||||
layout "settings"
|
||||
|
||||
def destroy
|
||||
@identity = Current.user.oidc_identities.find(params[:id])
|
||||
|
||||
# Prevent unlinking last identity if user has no password
|
||||
if Current.user.oidc_identities.count == 1 && Current.user.password_digest.blank?
|
||||
redirect_to settings_security_path, alert: t(".cannot_unlink_last")
|
||||
return
|
||||
end
|
||||
|
||||
provider_name = @identity.provider
|
||||
@identity.destroy!
|
||||
|
||||
# Log account unlinking
|
||||
SsoAuditLog.log_unlink!(
|
||||
user: Current.user,
|
||||
provider: provider_name,
|
||||
request: request
|
||||
)
|
||||
|
||||
redirect_to settings_security_path, notice: t(".success", provider: provider_name)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user