add: invite codes

This commit is contained in:
trisua 2025-06-22 13:03:02 -04:00
parent d1a074eaeb
commit 626c6711ef
19 changed files with 410 additions and 10 deletions

View file

@ -13,6 +13,9 @@ pub struct SecurityConfig {
/// The name of the header which will contain the real IP of the connecting user.
#[serde(default = "default_real_ip_header")]
pub real_ip_header: String,
/// If users require an invite code to register. Invite codes can be generated by supporters.
#[serde(default = "default_enable_invite_codes")]
pub enable_invite_codes: bool,
}
fn default_security_registration_enabled() -> bool {
@ -23,11 +26,16 @@ fn default_real_ip_header() -> String {
"CF-Connecting-IP".to_string()
}
fn default_enable_invite_codes() -> bool {
false
}
impl Default for SecurityConfig {
fn default() -> Self {
Self {
registration_enabled: default_security_registration_enabled(),
real_ip_header: default_real_ip_header(),
enable_invite_codes: default_enable_invite_codes(),
}
}
}
@ -341,6 +349,7 @@ fn default_banned_usernames() -> Vec<String> {
"stacks".to_string(),
"stack".to_string(),
"search".to_string(),
"journals".to_string(),
]
}