From a9c6140a60af736b0f8a81ae28bc417ca78a9ad3 Mon Sep 17 00:00:00 2001 From: James Smith Date: Wed, 4 Sep 2024 23:38:34 +0100 Subject: [PATCH 1/2] fix first use authentication --- app/controllers/application_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 27e9b8e5a..e432bea99 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -21,6 +21,7 @@ def authenticate_admin_user! end def check_for_first_use + authenticate_user! if User.count == 0 redirect_to(edit_user_registration_path) if current_user&.reset_password_token == "first_use" end From de0038b7b87a90440cdfcdab05da81a638278d06 Mon Sep 17 00:00:00 2001 From: James Smith Date: Wed, 4 Sep 2024 23:43:36 +0100 Subject: [PATCH 2/2] don't need to do first-use check on health controller --- app/controllers/health_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/health_controller.rb b/app/controllers/health_controller.rb index 23a9e6ff7..31847c771 100644 --- a/app/controllers/health_controller.rb +++ b/app/controllers/health_controller.rb @@ -2,6 +2,7 @@ class HealthController < ApplicationController after_action :verify_policy_scoped, except: :index + skip_before_action :check_for_first_use def index render json: {status: "OK"}, status: :ok