set minimum username length to 3 when changing your username
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/push/publish-docs Pipeline was successful

This commit is contained in:
Radical 2025-07-06 17:54:22 +02:00
parent 000f798e25
commit 4b9336dcd9

View file

@ -124,7 +124,7 @@ impl Me {
} }
pub async fn set_username(&mut self, data: &Data, new_username: String) -> Result<(), Error> { 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())); return Err(Error::BadRequest("Invalid username".to_string()));
} }