FIX: Forward to SSO login automatically

Forward to SSO login URL automatically if SSO is enabled and login is required.

Makes it simpler for users to log in automatically.
This commit is contained in:
Sigurður Guðbrandsson 2015-02-23 21:20:36 +00:00
parent ca5730018a
commit 334a357363

View File

@ -389,7 +389,13 @@ class ApplicationController < ActionController::Base
# save original URL in a cookie
cookies[:destination_url] = request.original_url unless request.original_url =~ /uploads/
redirect_to :login if SiteSetting.login_required?
# redirect user to the SSO page if we need to log in AND SSO is enabled
if (SiteSetting.enable_sso && SiteSetting.login_required)
redirect_to '/session/sso'
elsif SiteSetting.login_required?
redirect_to :login
end
end
def block_if_readonly_mode