FIX: Don't allow DiscourseConnect logins in readonly mode (#16508)

This commit is contained in:
Daniel Waterworth 2022-04-19 12:33:31 -05:00 committed by GitHub
parent d196ec9680
commit f55edd54fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -121,6 +121,7 @@ class SessionController < ApplicationController
end
def sso_login
return render_sso_error(text: I18n.t("read_only_mode_enabled"), status: 503) if @readonly_mode
raise Discourse::NotFound.new unless SiteSetting.enable_discourse_connect
params.require(:sso)

View File

@ -1112,6 +1112,20 @@ describe SessionController do
expect(logged_on_user.email).to eq(@user.email)
end
end
context "in readonly mode" do
use_redis_snapshotting
before do
Discourse.enable_readonly_mode
end
it "disallows requests" do
get "/session/sso_login"
expect(response.status).to eq(503)
end
end
end
describe '#sso_provider' do