OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Rename limit_condition -> discriminator
Oliver Günther24af9f96b5d7
diff --git a/lib/open_project/rate_limiting/api_v3.rb b/lib/open_project/rate_limiting/api_v3.rbindex c184f97fd60..121811517d8 100644--- a/lib/open_project/rate_limiting/api_v3.rb+++ b/lib/open_project/rate_limiting/api_v3.rb@@ -15,7 +15,7 @@ module OpenProjectprotected- def limit_condition(req)+ def discriminator(req)if req.post? && req.path.start_with?('/api/v3/') && req.path.end_with?('/form')session_id(req.env) || http_auth(req.env)enddiff --git a/lib/open_project/rate_limiting/base.rb b/lib/open_project/rate_limiting/base.rbindex 4dd292a1668..bef7ca87c06 100644--- a/lib/open_project/rate_limiting/base.rb+++ b/lib/open_project/rate_limiting/base.rb@@ -27,7 +27,7 @@ module OpenProjectdef apply!Rack::Attack.throttle(rule_name, limit:, period:) do |request|- limit_condition(request)+ discriminator(request)endself@@ -86,7 +86,7 @@ module OpenProjectfalseend- def limit_condition(request)+ def discriminator(request)raise NotImplementedErrorenddiff --git a/lib/open_project/rate_limiting/lost_password.rb b/lib/open_project/rate_limiting/lost_password.rbindex 59a5dbfd8ea..51916ec4a30 100644--- a/lib/open_project/rate_limiting/lost_password.rb+++ b/lib/open_project/rate_limiting/lost_password.rb@@ -21,7 +21,7 @@ module OpenProjectfalseend- def limit_condition(req)+ def discriminator(req)if req.post? && req.path.end_with?('/account/lost_password')req.env.dig "rack.request.form_hash", "mail"end