Skip to content

Commit 26938bf

Browse files
do not allow comma in names
1 parent 096c48f commit 26938bf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/validator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub fn user_role_name(name: &str) -> Result<(), UsernameValidationError> {
125125
prev_was_special = false;
126126
}
127127
// Allow specific special characters
128-
'_' | '-' | '.' | ',' => {
128+
'_' | '-' | '.' => {
129129
if prev_was_special {
130130
return Err(UsernameValidationError::ConsecutiveSpecialChars);
131131
}
@@ -192,15 +192,15 @@ pub mod error {
192192
#[error("Username should be between 3 and 64 chars long")]
193193
InvalidLength,
194194
#[error(
195-
"Username contains invalid characters. Only alphanumeric characters and _, -, ., , are allowed"
195+
"Username contains invalid characters. Only alphanumeric characters and special characters (underscore, hyphen and dot) are allowed"
196196
)]
197197
SpecialChar,
198198
#[error("Username should start with an alphanumeric character")]
199199
InvalidStartChar,
200200
#[error("Username should end with an alphanumeric character")]
201201
InvalidEndChar,
202202
#[error(
203-
"Username contains invalid characters. Only alphanumeric characters and _, -, ., , are allowed"
203+
"Username contains invalid characters. Only alphanumeric characters and special characters (underscore, hyphen and dot) are allowed"
204204
)]
205205
InvalidCharacter,
206206
#[error("Username contains consecutive special characters")]

0 commit comments

Comments
 (0)