aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-07 17:49:32 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-07 17:49:32 -0800
commit75c9831cf6e71b7a24e99e34cbe74845d1bfeed0 (patch)
tree4f9dd8619a95ab52b052564add7e3bdd4fa8beff /rust/src
parent01facf0167b4d1033c6af20ba98874757dbc46e5 (diff)
downloadfatcat-75c9831cf6e71b7a24e99e34cbe74845d1bfeed0.tar.gz
fatcat-75c9831cf6e71b7a24e99e34cbe74845d1bfeed0.zip
commit missing bits from username length change
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/api_helpers.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/rust/src/api_helpers.rs b/rust/src/api_helpers.rs
index 5e68d8e2..5ee529b9 100644
--- a/rust/src/api_helpers.rs
+++ b/rust/src/api_helpers.rs
@@ -359,7 +359,7 @@ pub fn uuid2fcid(id: &Uuid) -> String {
pub fn check_username(raw: &str) -> Result<()> {
lazy_static! {
- static ref RE: Regex = Regex::new(r"^[A-Za-z0-9][A-Za-z0-9._-]{2,19}$").unwrap();
+ static ref RE: Regex = Regex::new(r"^[A-Za-z][A-Za-z0-9._-]{2,24}$").unwrap();
}
if RE.is_match(raw) {
Ok(())
@@ -380,6 +380,8 @@ fn test_check_username() {
assert!(check_username("friend-bot").is_ok());
assert!(check_username("dog").is_ok());
assert!(check_username("g_____").is_ok());
+ assert!(check_username("bnewbold2-archive").is_ok());
+ assert!(check_username("bnewbold2-internetarchive").is_ok());
assert!(check_username("").is_err());
assert!(check_username("_").is_err());