From 74557bd79db912f69a1b8d6ffdf9a8e0b95031e3 Mon Sep 17 00:00:00 2001 From: Songtronix Date: Wed, 19 Aug 2020 13:24:06 +0200 Subject: [PATCH] fix: match alias validation to auth --- common/src/comp/player.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/src/comp/player.rs b/common/src/comp/player.rs index 3c4bbe2002..d0376c2e5a 100644 --- a/common/src/comp/player.rs +++ b/common/src/comp/player.rs @@ -32,7 +32,12 @@ impl Player { pub fn is_valid(&self) -> bool { Self::alias_is_valid(&self.alias) } pub fn alias_is_valid(alias: &str) -> bool { - alias.chars().all(|c| c.is_alphanumeric() || c == '_') && alias.len() <= MAX_ALIAS_LEN + // TODO: Expose auth name validation and use it here. + // See https://gitlab.com/veloren/auth/-/blob/master/server/src/web.rs#L20 + alias + .chars() + .all(|c| c.is_alphanumeric() || c == '_' || c == '-') + && alias.len() <= MAX_ALIAS_LEN } /// Not to be confused with uid