diff --git a/Cargo.lock b/Cargo.lock index b2b00be5..23457c4e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2721,7 +2721,7 @@ dependencies = [ [[package]] name = "ruma" version = "0.10.1" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" dependencies = [ "assign", "js_int", @@ -2741,7 +2741,7 @@ dependencies = [ [[package]] name = "ruma-appservice-api" version = "0.10.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" dependencies = [ "js_int", "ruma-common", @@ -2753,7 +2753,7 @@ dependencies = [ [[package]] name = "ruma-client-api" version = "0.18.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" dependencies = [ "as_variant", "assign", @@ -2776,7 +2776,7 @@ dependencies = [ [[package]] name = "ruma-common" version = "0.13.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" dependencies = [ "as_variant", "base64 0.22.1", @@ -2806,7 +2806,7 @@ dependencies = [ [[package]] name = "ruma-events" version = "0.28.1" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" dependencies = [ "as_variant", "indexmap 2.2.6", @@ -2828,7 +2828,7 @@ dependencies = [ [[package]] name = "ruma-federation-api" version = "0.9.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" dependencies = [ "js_int", "ruma-common", @@ -2840,7 +2840,7 @@ dependencies = [ [[package]] name = "ruma-identifiers-validation" version = "0.9.5" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" dependencies = [ "js_int", "thiserror", @@ -2849,7 +2849,7 @@ dependencies = [ [[package]] name = "ruma-identity-service-api" version = "0.9.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" dependencies = [ "js_int", "ruma-common", @@ -2859,7 +2859,7 @@ dependencies = [ [[package]] name = "ruma-macros" version = "0.13.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" dependencies = [ "once_cell", "proc-macro-crate", @@ -2874,7 +2874,7 @@ dependencies = [ [[package]] name = "ruma-push-gateway-api" version = "0.9.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" dependencies = [ "js_int", "ruma-common", @@ -2886,7 +2886,7 @@ dependencies = [ [[package]] name = "ruma-signatures" version = "0.15.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" dependencies = [ "base64 0.22.1", "ed25519-dalek", @@ -2902,7 +2902,7 @@ dependencies = [ [[package]] name = "ruma-state-res" version = "0.11.0" -source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#042444dc1d30c40a97e5acd7cebcda4ed1f76ed6" +source = "git+https://github.com/girlbossceo/ruwuma?branch=conduwuit-changes#e9302a955614429ca969eb4c7f561fc87a4f6f15" dependencies = [ "itertools 0.12.1", "js_int", diff --git a/src/main/Cargo.toml b/src/main/Cargo.toml index 94c62656..373ea878 100644 --- a/src/main/Cargo.toml +++ b/src/main/Cargo.toml @@ -67,6 +67,7 @@ dev_release_log_level = [ ] element_hacks = [ "conduit-api/element_hacks", + "conduit-service/element_hacks", ] gzip_compression = [ "conduit-api/gzip_compression", diff --git a/src/service/Cargo.toml b/src/service/Cargo.toml index 3bfd0e51..63e3e95f 100644 --- a/src/service/Cargo.toml +++ b/src/service/Cargo.toml @@ -17,6 +17,7 @@ crate-type = [ ] [features] +element_hacks = [] dev_release_log_level = [] release_max_log_level = [ "tracing/max_level_trace", diff --git a/src/service/uiaa/mod.rs b/src/service/uiaa/mod.rs index 11f848ad..bec6c15b 100644 --- a/src/service/uiaa/mod.rs +++ b/src/service/uiaa/mod.rs @@ -58,9 +58,22 @@ impl Service { AuthData::Password(Password { identifier, password, + #[cfg(feature = "element_hacks")] + user, .. }) => { - let UserIdentifier::UserIdOrLocalpart(username) = identifier else { + #[cfg(feature = "element_hacks")] + let username = if let Some(UserIdentifier::UserIdOrLocalpart(username)) = identifier { + username + } else if let Some(username) = user { + username + } else { + return Err(Error::BadRequest(ErrorKind::Unrecognized, "Identifier type not recognized.")); + }; + + #[cfg(not(feature = "element_hacks"))] + let Some(UserIdentifier::UserIdOrLocalpart(username)) = identifier + else { return Err(Error::BadRequest(ErrorKind::Unrecognized, "Identifier type not recognized.")); };