mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-15 13:16:56 +00:00
feat: Disable challengeless registration without signing a waiver
This commit is contained in:
6 files changed
+21
-18
No files matched your search
@@ -180,7 +180,7 @@ pub fn check(config: &Config) -> Result {
|
||||
}
|
||||
|
||||
if config.allow_registration
|
||||
&& config.yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse
|
||||
&& config.enable_challengeless_registration()
|
||||
&& config.registration_token.is_none()
|
||||
&& config.registration_token_file.is_none()
|
||||
{
|
||||
|
||||
@@ -806,6 +806,9 @@ pub struct Config {
|
||||
|
||||
/// Enabling this setting opens registration to anyone without restrictions.
|
||||
/// This makes your server vulnerable to abuse
|
||||
///
|
||||
/// Only works if continuwuity was compiled from source with the
|
||||
/// "openreg" compile-time feature.
|
||||
#[serde(default)]
|
||||
pub yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse: bool,
|
||||
|
||||
@@ -2896,6 +2899,19 @@ impl Config {
|
||||
}
|
||||
|
||||
pub fn check(&self) -> Result<(), Error> { check(self) }
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn enable_challengeless_registration(&self) -> bool {
|
||||
cfg!(feature = "openreg")
|
||||
&& self.yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse
|
||||
}
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
pub fn enable_challengeless_registration(&self) -> bool { false }
|
||||
}
|
||||
|
||||
fn true_fn() -> bool { true }
|
||||
|
||||
Reference in new issue
Block a user