fix in smtp and split rs files

This commit is contained in:
Mateusz Gruszczyński
2026-07-27 23:02:20 +02:00
parent d6c1c52310
commit e7a580a278
15 changed files with 1022 additions and 341 deletions
+10 -2
View File
@@ -172,12 +172,20 @@ pub async fn authenticate(
}
fn directory_nickname(display_name: &str, email: &str, username: &str) -> String {
let words: Vec<&str> = display_name.split_whitespace().filter(|v| !v.is_empty()).collect();
let words: Vec<&str> = display_name
.split_whitespace()
.filter(|v| !v.is_empty())
.collect();
let candidate = if words.len() >= 2 {
let first = words[0].chars().next().unwrap_or('u');
format!("{}.{}", first, words[words.len() - 1])
} else {
email.split('@').next().filter(|v| !v.is_empty()).unwrap_or(username).to_owned()
email
.split('@')
.next()
.filter(|v| !v.is_empty())
.unwrap_or(username)
.to_owned()
};
candidate.to_lowercase()
}