feat: allow more safe characters in the username
This commit is contained in:
@@ -45,8 +45,8 @@ people joining in with the respective privileges. Further, `bob@work` can join o
|
||||
`h@cafe`, whose comment is tagged as `:admin` will be able to join the chat with admin privileges.
|
||||
|
||||
> [!NOTE]
|
||||
Usernames may only contain ASCII alphanumeric characters and the `@`
|
||||
symbol. All other characters will be stripped.
|
||||
Usernames may only contain ASCII alphanumeric characters and the symbols `@-_.`.
|
||||
All other characters will be stripped.
|
||||
|
||||
### Getting started
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ use russh::keys::ssh_key::public::KeyData;
|
||||
pub fn sanitize_name(s: &str) -> String {
|
||||
let mut sanitized = String::with_capacity(s.len());
|
||||
for c in s.chars() {
|
||||
let ok = c.is_ascii_alphanumeric() || c == '@';
|
||||
let ok = c.is_ascii_alphanumeric() || "@_-.".contains(c);
|
||||
if !ok {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user