From 96e6fd34494afcc9ac5f6cd0589cbc3ab6d26dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigur=C3=B0ur=20Gu=C3=B0brandsson?= Date: Mon, 23 Feb 2015 22:10:44 +0000 Subject: [PATCH] Cleaned up the sso codefix, thanks @SamSaffron @SamSaffron showed me a cleaner way to use the if statements in the sso redirect code. Thanks sam ;) --- app/controllers/application_controller.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ced1ed88d..4e44a4885 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -391,10 +391,12 @@ class ApplicationController < ActionController::Base cookies[:destination_url] = request.original_url unless request.original_url =~ /uploads/ # 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 + if SiteSetting.login_required? + if SiteSetting.enable_sso? + redirect_to '/session/sso' + else + redirect_to :login + end end end