diff options
author | Kim Alvefur <zash@zash.se> | 2023-07-16 20:49:33 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2023-07-16 20:49:33 +0200 |
commit | 1987a7411f6aab1b0534ef23dc8797362eae1076 (patch) | |
tree | 47c52d7b27c3b76cb1356f1a512105f1df2e8592 /plugins/mod_register_limits.lua | |
parent | 903e945d09ffd94ebf3f08b6c5092a56ad484348 (diff) | |
download | prosody-1987a7411f6aab1b0534ef23dc8797362eae1076.tar.gz prosody-1987a7411f6aab1b0534ef23dc8797362eae1076.zip |
plugins: Switch to :get_option_period() for time range options
Improves readability ("1 day" vs 86400) and centralizes validation.
Diffstat (limited to 'plugins/mod_register_limits.lua')
-rw-r--r-- | plugins/mod_register_limits.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/mod_register_limits.lua b/plugins/mod_register_limits.lua index b3c6806c..dd78fc7c 100644 --- a/plugins/mod_register_limits.lua +++ b/plugins/mod_register_limits.lua @@ -16,13 +16,13 @@ local parse_cidr = ip_util.parse_cidr; local errors = require "prosody.util.error"; -- COMPAT drop old option names -local min_seconds_between_registrations = module:get_option_number("min_seconds_between_registrations"); +local min_seconds_between_registrations = module:get_option_period("min_seconds_between_registrations"); local allowlist_only = module:get_option_boolean("allowlist_registration_only", module:get_option_boolean("whitelist_registration_only")); local allowlisted_ips = module:get_option_set("registration_allowlist", module:get_option("registration_whitelist", { "127.0.0.1", "::1" }))._items; local blocklisted_ips = module:get_option_set("registration_blocklist", module:get_option_set("registration_blacklist", {}))._items; local throttle_max = module:get_option_number("registration_throttle_max", min_seconds_between_registrations and 1); -local throttle_period = module:get_option_number("registration_throttle_period", min_seconds_between_registrations); +local throttle_period = module:get_option_period("registration_throttle_period", min_seconds_between_registrations); local throttle_cache_size = module:get_option_number("registration_throttle_cache_size", 100); local blocklist_overflow = module:get_option_boolean("blocklist_on_registration_throttle_overload", module:get_option_boolean("blacklist_on_registration_throttle_overload", false)); |