From 3f56cd4ec510d1a9d36c8087695ce1f9f10f974c Mon Sep 17 00:00:00 2001 From: Brian Kephart Date: Fri, 8 Sep 2017 00:06:23 -0500 Subject: [PATCH] Allow access to login page for inactive sites, but only allow admins to login. --- app/controllers/camaleon_cms/camaleon_controller.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/camaleon_cms/camaleon_controller.rb b/app/controllers/camaleon_cms/camaleon_controller.rb index be6951223..5bd7861d7 100644 --- a/app/controllers/camaleon_cms/camaleon_controller.rb +++ b/app/controllers/camaleon_cms/camaleon_controller.rb @@ -100,7 +100,14 @@ def cama_site_check_existence() # inactive page control if current_site.is_inactive? p = current_site.posts.find(current_site.get_option('page_inactive')).decorate - redirect_to(p.the_url) if params != {"controller"=>"camaleon_cms/frontend", "action"=>"post", "slug"=>p.the_slug} + if request.original_url.to_s.match /\A#{current_site.the_url}admin(\/|\z)/ + if cama_current_user.present? + cama_logout_user + flash[:error] = ('Site is Inactive') + end + else + redirect_to(p.the_url) unless params == {"controller"=>"camaleon_cms/frontend", "action"=>"post", "slug"=>p.the_slug} + end end # maintenance page and IP's control