add: allow commas in names

https://tetratto.com/post/182999539626541056
This commit is contained in:
trisua 2025-05-19 19:38:10 -04:00
parent efb259764e
commit 6fa273b9f5
3 changed files with 6 additions and 2 deletions

View file

@ -1,3 +1,4 @@
use super::common::NAME_REGEX;
use super::*;
use crate::cache::Cache;
use crate::model::auth::UserConnections;
@ -128,7 +129,7 @@ impl DataManager {
return Err(Error::MiscError("This username cannot be used".to_string()));
}
let regex = regex::RegexBuilder::new(r"[^\w_\-\.!]+")
let regex = regex::RegexBuilder::new(NAME_REGEX)
.multi_line(true)
.build()
.unwrap();

View file

@ -6,6 +6,8 @@ use crate::{
};
use super::DataManager;
pub const NAME_REGEX: &str = r"[^\w_\-\.,!]+";
impl DataManager {
pub async fn init(&self) -> Result<()> {
let conn = match self.connect().await {

View file

@ -1,3 +1,4 @@
use super::common::NAME_REGEX;
use super::*;
use crate::cache::Cache;
use crate::model::communities::{CommunityContext, CommunityJoinAccess, CommunityMembership};
@ -398,7 +399,7 @@ impl DataManager {
return Err(Error::MiscError("This title cannot be used".to_string()));
}
let regex = regex::RegexBuilder::new(r"[^\w_\-\.!]+")
let regex = regex::RegexBuilder::new(NAME_REGEX)
.multi_line(true)
.build()
.unwrap();