Check if username is alphanumeric

This commit is contained in:
Bastian Gruber 2023-04-29 19:01:11 +02:00
parent c6a8c417ef
commit 30a8894f76
No known key found for this signature in database
GPG key ID: BE9F8C772B188CBF

View file

@ -57,7 +57,7 @@ async fn main() -> Result<()> {
// we won't process until we find one.
match framed.next().await {
Some(Ok(username)) => {
if !username.is_empty() && username.is_ascii() {
if !username.is_empty() && name.chars().all(char::is_alphanumeric) {
name = username.clone();
db.0.lock().unwrap().insert(username.clone(), address);
let message = compose_message(username.clone(), db.clone());