forked from jmug/stoatchat
chore: loosen username restrictions
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export version=0.5.3-patch.2
|
export version=0.5.3-1
|
||||||
echo "pub const VERSION: &str = \"${version}\";" > src/version.rs
|
echo "pub const VERSION: &str = \"${version}\";" > src/version.rs
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ pub async fn create_bot(db: &Db, user: User, info: Json<DataCreateBot>) -> Resul
|
|||||||
let id = Ulid::new().to_string();
|
let id = Ulid::new().to_string();
|
||||||
let bot_user = User {
|
let bot_user = User {
|
||||||
id: id.clone(),
|
id: id.clone(),
|
||||||
username: info.name,
|
username: info.name.trim().to_string(),
|
||||||
bot: Some(BotInformation {
|
bot: Some(BotInformation {
|
||||||
owner: user.id.clone(),
|
owner: user.id.clone(),
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ pub async fn req(
|
|||||||
data: Json<DataChangeUsername>,
|
data: Json<DataChangeUsername>,
|
||||||
) -> Result<Json<User>> {
|
) -> Result<Json<User>> {
|
||||||
let data = data.into_inner();
|
let data = data.into_inner();
|
||||||
|
data.validate()
|
||||||
|
.map_err(|error| Error::FailedValidation { error })?;
|
||||||
|
|
||||||
account
|
account
|
||||||
.verify_password(&data.password)
|
.verify_password(&data.password)
|
||||||
.map_err(|_| Error::InvalidCredentials)?;
|
.map_err(|_| Error::InvalidCredentials)?;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
|
||||||
pub static RE_USERNAME: Lazy<Regex> = Lazy::new(|| Regex::new(r"^[a-zA-Z0-9_.]+$").unwrap());
|
pub static RE_USERNAME: Lazy<Regex> = Lazy::new(|| Regex::new(r"^[^\u200B]+$").unwrap());
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
pub const VERSION: &str = "0.5.3-patch.2";
|
pub const VERSION: &str = "0.5.3-1";
|
||||||
|
|||||||
Reference in New Issue
Block a user