From 4b9336dcd9f344fc3837718f7bc7097742623092 Mon Sep 17 00:00:00 2001 From: Radical Date: Sun, 6 Jul 2025 17:54:22 +0200 Subject: [PATCH] set minimum username length to 3 when changing your username --- src/objects/me.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objects/me.rs b/src/objects/me.rs index d99a7b4..92797ee 100644 --- a/src/objects/me.rs +++ b/src/objects/me.rs @@ -124,7 +124,7 @@ impl Me { } pub async fn set_username(&mut self, data: &Data, new_username: String) -> Result<(), Error> { - if !USERNAME_REGEX.is_match(&new_username) { + if !USERNAME_REGEX.is_match(&new_username) || new_username.len() < 3 || new_username.len() > 32 { return Err(Error::BadRequest("Invalid username".to_string())); }