From 14774fa15358911cd88e1e848ebfbf690f5876b4 Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Tue, 8 Jul 2025 19:32:23 +0100 Subject: [PATCH] feat(recaptcha): Don't allow pubkey without associated privkey --- src/core/config/check.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/config/check.rs b/src/core/config/check.rs index 8a3d1f77..6710a91a 100644 --- a/src/core/config/check.rs +++ b/src/core/config/check.rs @@ -180,11 +180,18 @@ pub fn check(config: &Config) -> Result { } } + if config.recaptcha_site_key.is_some() && config.recaptcha_private_site_key.is_none() { + return Err!(Config( + "recaptcha_private_site_key", + "reCAPTCHA private site key is required when reCAPTCHA site key is set." + )); + } + if config.allow_registration && !config.yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse && config.registration_token.is_none() && config.registration_token_file.is_none() - && !(config.recaptcha_site_key.is_some() && config.recaptcha_private_site_key.is_some()) + && config.recaptcha_site_key.is_none() { return Err!(Config( "registration_token",