Simplify feature condition.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -125,27 +125,17 @@ pub async fn try_auth(
|
|||||||
|
|
||||||
match auth {
|
match auth {
|
||||||
// Find out what the user completed
|
// Find out what the user completed
|
||||||
| AuthData::Password(Password {
|
| AuthData::Password(Password { identifier, password, user, .. }) => {
|
||||||
identifier,
|
|
||||||
password,
|
|
||||||
#[cfg(feature = "element_hacks")]
|
|
||||||
user,
|
|
||||||
..
|
|
||||||
}) => {
|
|
||||||
#[cfg(feature = "element_hacks")]
|
|
||||||
let username = if let Some(UserIdentifier::UserIdOrLocalpart(username)) = identifier {
|
let username = if let Some(UserIdentifier::UserIdOrLocalpart(username)) = identifier {
|
||||||
username
|
username
|
||||||
} else if let Some(username) = user {
|
} else if cfg!(feature = "element_hacks")
|
||||||
|
&& let Some(username) = user
|
||||||
|
{
|
||||||
username
|
username
|
||||||
} else {
|
} else {
|
||||||
return Err!(Request(Unrecognized("Identifier type not recognized.")));
|
return Err!(Request(Unrecognized("Identifier type not recognized.")));
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(feature = "element_hacks"))]
|
|
||||||
let Some(UserIdentifier::UserIdOrLocalpart(username)) = identifier else {
|
|
||||||
return Err!(Request(Unrecognized("Identifier type not recognized.")));
|
|
||||||
};
|
|
||||||
|
|
||||||
let user_id_from_username = UserId::parse_with_server_name(
|
let user_id_from_username = UserId::parse_with_server_name(
|
||||||
username.clone(),
|
username.clone(),
|
||||||
self.services.globals.server_name(),
|
self.services.globals.server_name(),
|
||||||
|
|||||||
Reference in New Issue
Block a user