Skip to content

Commit

Permalink
update regex for username validation
Browse files Browse the repository at this point in the history
  • Loading branch information
darknight committed May 15, 2024
1 parent 25fe939 commit 1b717e1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ee/tabby-schema/src/schema/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ pub struct UpdateUserNameInput {
#[validate(regex(
code = "username",
path = "crate::schema::constants::USERNAME_REGEX",
message = "Invalid username, only alphanumeric characters, _ and - are allowed"
message = "Invalid username, only alphabet and space character are allowed, and it must start and end with alphabet"
))]
pub name: String,
}
Expand Down
2 changes: 1 addition & 1 deletion ee/tabby-schema/src/schema/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ use regex::Regex;

lazy_static! {
pub static ref REPOSITORY_NAME_REGEX: Regex = Regex::new("^[a-zA-Z][\\w.-]+$").unwrap();
pub static ref USERNAME_REGEX: Regex = Regex::new("^[a-zA-Z0-9_-]+$").unwrap();
pub static ref USERNAME_REGEX: Regex = Regex::new("^[A-Za-z][A-Za-z ]*[A-Za-z]$").unwrap();
}

0 comments on commit 1b717e1

Please sign in to comment.