set minimum username length to 3 when changing your username
This commit is contained in:
parent
000f798e25
commit
4b9336dcd9
1 changed files with 1 additions and 1 deletions
|
@ -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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue