fix in smtp and split rs files
This commit is contained in:
+10
-2
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user