feat: forbid certain usernames & room aliases

squashed from https://gitlab.com/famedly/conduit/-/merge_requests/582

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
Matthias Ahouansou 2024-02-08 19:11:48 -05:00 committed by June
parent 784d307425
commit fc93b29abe
8 changed files with 143 additions and 1 deletions

View file

@ -166,6 +166,18 @@ pub async fn create_room_route(
));
}
// check if room alias is forbidden
if services()
.globals
.forbidden_room_names()
.is_match(localpart)
{
return Err(Error::BadRequest(
ErrorKind::Unknown,
"Room alias name is forbidden.",
));
}
let alias = RoomAliasId::parse(format!(
"#{}:{}",
localpart,