Simple plugin to create landing page for SSO not working anymore

AI-generated summary

A user, jimkleiber, created a plugin in March 2022 to override the redirect_to_login method in Discourse, forcing users to a login page instead of automatically logging in with SSO. The plugin worked initially but has since stopped working, and the user is seeking help to determine why. The plugin’s enable setting never worked, and the user is also looking for a solution to this issue.

Continuing the discussion from Landing page on saml login:

I’m not sure if this should be in Support or Development or something else, so feel free to move it as you deem necessary.

I created a plugin in March 2022 to override the function above and it seemed to work for a while and then now noticed that it isn’t working (I don’t know for how long).

Does anyone have an idea why it may have stopped?

(note, the enable setting never worked, so if anyone knows why that also doesn’t work, I’d be grateful)

enabled_site_setting :no_auto_login_enabled

after_initialize do
 	if SiteSetting.no_auto_login_enabled	
		class ::ApplicationController
		  module NoAutoLoginRedirectToLogin
			def redirect_to_login
				dont_cache_page
				cookies[:destination_url] = destination_url
				redirect_to path("/login")
			end
		  end	
		  prepend NoAutoLoginRedirectToLogin
		end
	end
end