export feature

This commit is contained in:
2026-05-09 20:51:29 +02:00
parent 1eaa3ca8a6
commit dcfc17f542
57 changed files with 2245 additions and 624 deletions

View File

@@ -184,10 +184,18 @@ impl Username {
let s = raw.trim().to_lowercase();
if s.len() < Self::MIN_LENGTH || s.len() > Self::MAX_LENGTH {
return Err(DomainError::ValidationError(
format!("Username must be {}{} characters", Self::MIN_LENGTH, Self::MAX_LENGTH).into(),
format!(
"Username must be {}{} characters",
Self::MIN_LENGTH,
Self::MAX_LENGTH
)
.into(),
));
}
if !s.chars().all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '-') {
if !s
.chars()
.all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '-')
{
return Err(DomainError::ValidationError(
"Username may only contain letters, digits, underscores, and hyphens".into(),
));