Fix short-circuit condition; propagate 403 in unlikely branch anyway. (fixes #219)
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -5,7 +5,7 @@ use ruma::api::client::account::{
|
|||||||
ThirdPartyIdRemovalStatus, change_password, deactivate, get_3pids,
|
ThirdPartyIdRemovalStatus, change_password, deactivate, get_3pids,
|
||||||
request_3pid_management_token_via_email, request_3pid_management_token_via_msisdn, whoami,
|
request_3pid_management_token_via_email, request_3pid_management_token_via_msisdn, whoami,
|
||||||
};
|
};
|
||||||
use tuwunel_core::{Err, Result, info, utils::ReadyExt};
|
use tuwunel_core::{Err, Result, err, info, utils::ReadyExt};
|
||||||
|
|
||||||
use crate::{Ruma, router::auth_uiaa};
|
use crate::{Ruma, router::auth_uiaa};
|
||||||
|
|
||||||
@@ -73,10 +73,12 @@ pub(crate) async fn whoami_route(
|
|||||||
Ok(whoami::v3::Response {
|
Ok(whoami::v3::Response {
|
||||||
user_id: body.sender_user().to_owned(),
|
user_id: body.sender_user().to_owned(),
|
||||||
device_id: body.sender_device.clone(),
|
device_id: body.sender_device.clone(),
|
||||||
is_guest: services
|
is_guest: body.appservice_info.is_none()
|
||||||
.users
|
&& services
|
||||||
.is_deactivated(body.sender_user())
|
.users
|
||||||
.await? && body.appservice_info.is_none(),
|
.is_deactivated(body.sender_user())
|
||||||
|
.await
|
||||||
|
.map_err(|_| err!(Request(Forbidden("User does not exist."))))?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user