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
|
end
|
||||||
|
|
||||||
def after_sign_out_path_for(_resource_or_scope)
|
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'
|
'/auth/auth/openid_connect/logout'
|
||||||
else
|
else
|
||||||
new_user_session_path
|
new_user_session_path
|
||||||
|
|
|
@ -11,7 +11,7 @@ module WebAppControllerConcern
|
||||||
end
|
end
|
||||||
|
|
||||||
def skip_csrf_meta_tags?
|
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
|
end
|
||||||
|
|
||||||
def set_app_body_class
|
def set_app_body_class
|
||||||
|
|
|
@ -49,7 +49,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def omniauth_only?
|
def omniauth_only?
|
||||||
Rails.configuration.omniauth.only
|
Rails.configuration.x.omniauth.only
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_to_login(name = nil, html_options = nil, &block)
|
def link_to_login(name = nil, html_options = nil, &block)
|
||||||
|
|
|
@ -12,7 +12,7 @@ module RegistrationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def omniauth_only?
|
def omniauth_only?
|
||||||
Rails.configuration.omniauth.only
|
Rails.configuration.x.omniauth.only
|
||||||
end
|
end
|
||||||
|
|
||||||
def ip_blocked?(remote_ip)
|
def ip_blocked?(remote_ip)
|
||||||
|
|
|
@ -125,6 +125,6 @@ class InitialStateSerializer < ActiveModel::Serializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def sso_redirect
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -113,7 +113,7 @@ module Mastodon
|
||||||
end
|
end
|
||||||
|
|
||||||
# Load config/omniauth.yml settings
|
# Load config/omniauth.yml settings
|
||||||
config.omniauth = config_for(:omniauth)
|
config.x.omniauth = config_for(:omniauth)
|
||||||
|
|
||||||
config.to_prepare do
|
config.to_prepare do
|
||||||
Doorkeeper::AuthorizationsController.layout 'modal'
|
Doorkeeper::AuthorizationsController.layout 'modal'
|
||||||
|
|
|
@ -10,26 +10,26 @@ end
|
||||||
|
|
||||||
Devise.setup do |config|
|
Devise.setup do |config|
|
||||||
# CAS strategy
|
# CAS strategy
|
||||||
if Rails.configuration.omniauth.cas_enabled
|
if Rails.configuration.x.omniauth.cas_enabled
|
||||||
config.omniauth(
|
config.omniauth(
|
||||||
:cas,
|
:cas,
|
||||||
Rails.configuration.omniauth.cas
|
Rails.configuration.x.omniauth.cas
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
# SAML strategy
|
# SAML strategy
|
||||||
if Rails.configuration.omniauth.saml_enabled
|
if Rails.configuration.x.omniauth.saml_enabled
|
||||||
config.omniauth(
|
config.omniauth(
|
||||||
:saml,
|
:saml,
|
||||||
Rails.configuration.omniauth.saml
|
Rails.configuration.x.omniauth.saml
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
# OpenID Connect Strategy
|
# OpenID Connect Strategy
|
||||||
if Rails.configuration.omniauth.oidc_enabled
|
if Rails.configuration.x.omniauth.oidc_enabled
|
||||||
config.omniauth(
|
config.omniauth(
|
||||||
:openid_connect,
|
:openid_connect,
|
||||||
Rails.configuration.omniauth.oidc
|
Rails.configuration.x.omniauth.oidc
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -88,10 +88,10 @@ describe ApplicationHelper do
|
||||||
|
|
||||||
context 'when in omniauth only mode' do
|
context 'when in omniauth only mode' do
|
||||||
around do |example|
|
around do |example|
|
||||||
original = Rails.configuration.omniauth.only
|
original = Rails.configuration.x.omniauth.only
|
||||||
Rails.configuration.omniauth.only = true
|
Rails.configuration.x.omniauth.only = true
|
||||||
example.run
|
example.run
|
||||||
Rails.configuration.omniauth.only = original
|
Rails.configuration.x.omniauth.only = original
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'redirects to joinmastodon site' do
|
it 'redirects to joinmastodon site' do
|
||||||
|
@ -109,10 +109,10 @@ describe ApplicationHelper do
|
||||||
describe 'omniauth_only?' do
|
describe 'omniauth_only?' do
|
||||||
context 'when configuration is set to true' do
|
context 'when configuration is set to true' do
|
||||||
around do |example|
|
around do |example|
|
||||||
original = Rails.configuration.omniauth.only
|
original = Rails.configuration.x.omniauth.only
|
||||||
Rails.configuration.omniauth.only = true
|
Rails.configuration.x.omniauth.only = true
|
||||||
example.run
|
example.run
|
||||||
Rails.configuration.omniauth.only = original
|
Rails.configuration.x.omniauth.only = original
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns true' do
|
it 'returns true' do
|
||||||
|
@ -122,10 +122,10 @@ describe ApplicationHelper do
|
||||||
|
|
||||||
context 'when configuration is false' do
|
context 'when configuration is false' do
|
||||||
around do |example|
|
around do |example|
|
||||||
original = Rails.configuration.omniauth.only
|
original = Rails.configuration.x.omniauth.only
|
||||||
Rails.configuration.omniauth.only = false
|
Rails.configuration.x.omniauth.only = false
|
||||||
example.run
|
example.run
|
||||||
Rails.configuration.omniauth.only = original
|
Rails.configuration.x.omniauth.only = original
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns false' do
|
it 'returns false' do
|
||||||
|
|
|
@ -129,15 +129,15 @@ describe 'OmniAuth callbacks' do
|
||||||
end
|
end
|
||||||
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
|
include_examples 'omniauth provider callbacks', :openid_connect
|
||||||
end
|
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
|
include_examples 'omniauth provider callbacks', :cas
|
||||||
end
|
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
|
include_examples 'omniauth provider callbacks', :saml
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue