Compare commits

...

3 Commits

Author SHA1 Message Date
Paul Makles
de5428348c fix: actually set the correct regex 2022-05-09 23:08:17 +01:00
Paul Makles
d7527d9131 chore: loosen username restrictions 2022-05-09 23:03:08 +01:00
Paul Makles
c59c4146c4 chore: bump quark, fixes #156 2022-05-08 10:13:45 +01:00
7 changed files with 14 additions and 6 deletions

2
Cargo.lock generated
View File

@@ -2999,7 +2999,7 @@ dependencies = [
[[package]]
name = "revolt-quark"
version = "0.1.0"
source = "git+https://github.com/revoltchat/quark?rev=0038475bd7203e385d0cb78eb138398d769ec41b#0038475bd7203e385d0cb78eb138398d769ec41b"
source = "git+https://github.com/revoltchat/quark?rev=45706b93d4da11cf3e0f3ca41514c73945bb348d#45706b93d4da11cf3e0f3ca41514c73945bb348d"
dependencies = [
"async-recursion",
"async-std",

View File

@@ -64,5 +64,5 @@ schemars = "0.8.8"
rocket_okapi = { git = "https://github.com/insertish/okapi", rev = "dcf0df115596ee07a587a7a543cddf3d7944645b", features = [ "swagger" ] }
# quark
revolt-quark = { git = "https://github.com/revoltchat/quark", rev = "0038475bd7203e385d0cb78eb138398d769ec41b" }
revolt-quark = { git = "https://github.com/revoltchat/quark", rev = "45706b93d4da11cf3e0f3ca41514c73945bb348d" }
# revolt-quark = { path = "../quark" }

View File

@@ -1,3 +1,3 @@
#!/bin/bash
export version=0.5.3
export version=0.5.3-2
echo "pub const VERSION: &str = \"${version}\";" > src/version.rs

View File

@@ -45,7 +45,7 @@ pub async fn create_bot(db: &Db, user: User, info: Json<DataCreateBot>) -> Resul
let id = Ulid::new().to_string();
let bot_user = User {
id: id.clone(),
username: info.name,
username: info.name.trim().to_string(),
bot: Some(BotInformation {
owner: user.id.clone(),
}),

View File

@@ -28,6 +28,9 @@ pub async fn req(
data: Json<DataChangeUsername>,
) -> Result<Json<User>> {
let data = data.into_inner();
data.validate()
.map_err(|error| Error::FailedValidation { error })?;
account
.verify_password(&data.password)
.map_err(|_| Error::InvalidCredentials)?;

View File

@@ -1,4 +1,9 @@
use once_cell::sync::Lazy;
use regex::Regex;
pub static RE_USERNAME: Lazy<Regex> = Lazy::new(|| Regex::new(r"^[a-zA-Z0-9_.]+$").unwrap());
/// Regex for valid usernames
///
/// Block zero width space
/// Block lookalike characters
pub static RE_USERNAME: Lazy<Regex> =
Lazy::new(|| Regex::new(r"^[^\u200BА-Яа-яΑ-Ωα-ω]+$").unwrap());

View File

@@ -1 +1 @@
pub const VERSION: &str = "0.5.3";
pub const VERSION: &str = "0.5.3-2";