forked from jmug/stoatchat
feat: automatically sanitise usernames on create/update (#689)
* feat: automatically sanitise usernames on create/update Signed-off-by: higgs01 <6546697+higgs01@users.noreply.github.com> * test: add tests for validation and sanitasion Signed-off-by: higgs01 <6546697+higgs01@users.noreply.github.com> * fix: Return only the sanitised string in sanitise_username (#424) * fix: Use as_str for role.id in insert_role * Run rustfmt for code changes Signed-off-by: jarvarvarvis <jarvistrigo@gmail.com> * feat: Make minimum username length configurable in Revolt.toml (#424) * fix: Remove redundant call to is_match with blocked username regex Signed-off-by: jarvarvarvis <jarvistrigo@gmail.com> * Update crates/core/database/src/models/users/model.rs Co-authored-by: Tom <iamtomahawkx@gmail.com> Signed-off-by: jarvarvarvis <53998846+jarvarvarvis@users.noreply.github.com> * Update crates/core/database/src/models/users/model.rs Co-authored-by: Tom <iamtomahawkx@gmail.com> Signed-off-by: jarvarvarvis <53998846+jarvarvarvis@users.noreply.github.com> * Update crates/core/database/src/models/users/model.rs Co-authored-by: Tom <iamtomahawkx@gmail.com> Signed-off-by: jarvarvarvis <53998846+jarvarvarvis@users.noreply.github.com> * Update crates/core/database/src/models/users/model.rs Co-authored-by: Tom <iamtomahawkx@gmail.com> Signed-off-by: jarvarvarvis <53998846+jarvarvarvis@users.noreply.github.com> * fix: Implement suggested changes and clean up last 4 commits Signed-off-by: jarvarvarvis <jarvistrigo@gmail.com> * fix: Disallow stoat as username, update create_user test Signed-off-by: jarvarvarvis <jarvistrigo@gmail.com> * fix: Use sanitised username to find updated discriminator Signed-off-by: jarvarvarvis <jarvistrigo@gmail.com> * feat: Sanitise revolt.chat in username Signed-off-by: jarvarvarvis <jarvistrigo@gmail.com> * fix: Implement discussed changes Signed-off-by: jarvarvarvis <jarvistrigo@gmail.com> * test: Fix create_user test Signed-off-by: jarvarvarvis <jarvistrigo@gmail.com> * fix: don't overflow the stack not entirely sure why this fixes it and I don't like it. But work it does. Signed-off-by: IAmTomahawkx <iamtomahawkx@gmail.com> * fix: revert odd file mode change Signed-off-by: jarvarvarvis <jarvistrigo@gmail.com> --------- Signed-off-by: higgs01 <6546697+higgs01@users.noreply.github.com> Signed-off-by: jarvarvarvis <jarvistrigo@gmail.com> Signed-off-by: jarvarvarvis <53998846+jarvarvarvis@users.noreply.github.com> Signed-off-by: IAmTomahawkx <iamtomahawkx@gmail.com> Co-authored-by: higgs01 <6546697+higgs01@users.noreply.github.com> Co-authored-by: Tom <iamtomahawkx@gmail.com>
This commit is contained in:
@@ -78,6 +78,8 @@ call_ring_duration = 30
|
||||
[api.livekit.nodes]
|
||||
|
||||
[api.users]
|
||||
# Minimum allowed length of usernames
|
||||
min_username_length = 2
|
||||
|
||||
[pushd]
|
||||
# this changes the names of the queues to not overlap
|
||||
|
||||
@@ -231,6 +231,7 @@ pub struct LiveKitNode {
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
pub struct ApiUsers {
|
||||
pub early_adopter_cutoff: Option<u64>,
|
||||
pub min_username_length: usize,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
|
||||
Reference in New Issue
Block a user