mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Move to x
namespace
This commit is contained in:
parent
ce31e0dee1
commit
a13281c84c
9 changed files with 24 additions and 24 deletions
|
@ -79,7 +79,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def after_sign_out_path_for(_resource_or_scope)
|
||||
if Rails.configuration.omniauth.only && Rails.configuration.omniauth.oidc_enabled
|
||||
if Rails.configuration.x.omniauth.only && Rails.configuration.x.omniauth.oidc_enabled
|
||||
'/auth/auth/openid_connect/logout'
|
||||
else
|
||||
new_user_session_path
|
||||
|
|
|
@ -11,7 +11,7 @@ module WebAppControllerConcern
|
|||
end
|
||||
|
||||
def skip_csrf_meta_tags?
|
||||
!(ENV['ONE_CLICK_SSO_LOGIN'] == 'true' && Rails.configuration.omniauth.only && Devise.omniauth_providers.length == 1) && current_user.nil?
|
||||
!(ENV['ONE_CLICK_SSO_LOGIN'] == 'true' && Rails.configuration.x.omniauth.only && Devise.omniauth_providers.length == 1) && current_user.nil?
|
||||
end
|
||||
|
||||
def set_app_body_class
|
||||
|
|
|
@ -49,7 +49,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def omniauth_only?
|
||||
Rails.configuration.omniauth.only
|
||||
Rails.configuration.x.omniauth.only
|
||||
end
|
||||
|
||||
def link_to_login(name = nil, html_options = nil, &block)
|
||||
|
|
|
@ -12,7 +12,7 @@ module RegistrationHelper
|
|||
end
|
||||
|
||||
def omniauth_only?
|
||||
Rails.configuration.omniauth.only
|
||||
Rails.configuration.x.omniauth.only
|
||||
end
|
||||
|
||||
def ip_blocked?(remote_ip)
|
||||
|
|
|
@ -125,6 +125,6 @@ class InitialStateSerializer < ActiveModel::Serializer
|
|||
end
|
||||
|
||||
def sso_redirect
|
||||
"/auth/auth/#{Devise.omniauth_providers[0]}" if ENV['ONE_CLICK_SSO_LOGIN'] == 'true' && Rails.configuration.omniauth.only && Devise.omniauth_providers.length == 1
|
||||
"/auth/auth/#{Devise.omniauth_providers[0]}" if ENV['ONE_CLICK_SSO_LOGIN'] == 'true' && Rails.configuration.x.omniauth.only && Devise.omniauth_providers.length == 1
|
||||
end
|
||||
end
|
||||
|
|
|
@ -113,7 +113,7 @@ module Mastodon
|
|||
end
|
||||
|
||||
# Load config/omniauth.yml settings
|
||||
config.omniauth = config_for(:omniauth)
|
||||
config.x.omniauth = config_for(:omniauth)
|
||||
|
||||
config.to_prepare do
|
||||
Doorkeeper::AuthorizationsController.layout 'modal'
|
||||
|
|
|
@ -10,26 +10,26 @@ end
|
|||
|
||||
Devise.setup do |config|
|
||||
# CAS strategy
|
||||
if Rails.configuration.omniauth.cas_enabled
|
||||
if Rails.configuration.x.omniauth.cas_enabled
|
||||
config.omniauth(
|
||||
:cas,
|
||||
Rails.configuration.omniauth.cas
|
||||
Rails.configuration.x.omniauth.cas
|
||||
)
|
||||
end
|
||||
|
||||
# SAML strategy
|
||||
if Rails.configuration.omniauth.saml_enabled
|
||||
if Rails.configuration.x.omniauth.saml_enabled
|
||||
config.omniauth(
|
||||
:saml,
|
||||
Rails.configuration.omniauth.saml
|
||||
Rails.configuration.x.omniauth.saml
|
||||
)
|
||||
end
|
||||
|
||||
# OpenID Connect Strategy
|
||||
if Rails.configuration.omniauth.oidc_enabled
|
||||
if Rails.configuration.x.omniauth.oidc_enabled
|
||||
config.omniauth(
|
||||
:openid_connect,
|
||||
Rails.configuration.omniauth.oidc
|
||||
Rails.configuration.x.omniauth.oidc
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -88,10 +88,10 @@ describe ApplicationHelper do
|
|||
|
||||
context 'when in omniauth only mode' do
|
||||
around do |example|
|
||||
original = Rails.configuration.omniauth.only
|
||||
Rails.configuration.omniauth.only = true
|
||||
original = Rails.configuration.x.omniauth.only
|
||||
Rails.configuration.x.omniauth.only = true
|
||||
example.run
|
||||
Rails.configuration.omniauth.only = original
|
||||
Rails.configuration.x.omniauth.only = original
|
||||
end
|
||||
|
||||
it 'redirects to joinmastodon site' do
|
||||
|
@ -109,10 +109,10 @@ describe ApplicationHelper do
|
|||
describe 'omniauth_only?' do
|
||||
context 'when configuration is set to true' do
|
||||
around do |example|
|
||||
original = Rails.configuration.omniauth.only
|
||||
Rails.configuration.omniauth.only = true
|
||||
original = Rails.configuration.x.omniauth.only
|
||||
Rails.configuration.x.omniauth.only = true
|
||||
example.run
|
||||
Rails.configuration.omniauth.only = original
|
||||
Rails.configuration.x.omniauth.only = original
|
||||
end
|
||||
|
||||
it 'returns true' do
|
||||
|
@ -122,10 +122,10 @@ describe ApplicationHelper do
|
|||
|
||||
context 'when configuration is false' do
|
||||
around do |example|
|
||||
original = Rails.configuration.omniauth.only
|
||||
Rails.configuration.omniauth.only = false
|
||||
original = Rails.configuration.x.omniauth.only
|
||||
Rails.configuration.x.omniauth.only = false
|
||||
example.run
|
||||
Rails.configuration.omniauth.only = original
|
||||
Rails.configuration.x.omniauth.only = original
|
||||
end
|
||||
|
||||
it 'returns false' do
|
||||
|
|
|
@ -129,15 +129,15 @@ describe 'OmniAuth callbacks' do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#openid_connect', if: Rails.configuration.omniauth.oidc_enabled && Rails.configuration.omniauth.oidc[:scope].present? do
|
||||
describe '#openid_connect', if: Rails.configuration.x.omniauth.oidc_enabled && Rails.configuration.x.omniauth.oidc[:scope].present? do
|
||||
include_examples 'omniauth provider callbacks', :openid_connect
|
||||
end
|
||||
|
||||
describe '#cas', if: Rails.configuration.omniauth.cas_enabled do
|
||||
describe '#cas', if: Rails.configuration.x.omniauth.cas_enabled do
|
||||
include_examples 'omniauth provider callbacks', :cas
|
||||
end
|
||||
|
||||
describe '#saml', if: Rails.configuration.omniauth.saml_enabled do
|
||||
describe '#saml', if: Rails.configuration.x.omniauth.saml_enabled do
|
||||
include_examples 'omniauth provider callbacks', :saml
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue