fix: use to_lowercase on /register/available username

This commit is contained in:
Timo Kösters 2022-01-31 15:39:46 +01:00
parent e17bbdd42d
commit 23aecb78c7
No known key found for this signature in database
GPG key ID: 356E705610F626D5

View file

@ -60,7 +60,7 @@ pub async fn get_register_available_route(
body: Ruma<get_username_availability::Request<'_>>,
) -> ConduitResult<get_username_availability::Response> {
// Validate user id
let user_id = UserId::parse_with_server_name(body.username.clone(), db.globals.server_name())
let user_id = UserId::parse_with_server_name(body.username.to_lowercase(), db.globals.server_name())
.ok()
.filter(|user_id| {
!user_id.is_historical() && user_id.server_name() == db.globals.server_name()