fix: don't allow user display name to be over 32 chars

This commit is contained in:
trisua 2025-05-20 23:30:40 -04:00
parent 946f78a90b
commit fb2a9285d2
4 changed files with 145 additions and 139 deletions

View file

@ -100,6 +100,11 @@ pub async fn update_user_settings_request(
return Json(Error::NotAllowed.into());
}
// check lengths
if req.display_name.len() > 32 {
return Json(Error::DataTooLong("display name".to_string()).into());
}
// check percentage themes
if !req.theme_sat.is_empty() && !req.theme_sat.ends_with("%") {
req.theme_sat = format!("{}%", req.theme_sat)