fix: reject /register requests when there is no token and the type is appservice

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
Matthias Ahouansou 2024-03-31 10:16:29 -04:00 committed by June
parent 7a1a271518
commit c61aee4f1c
2 changed files with 7 additions and 6 deletions

View file

@ -145,11 +145,7 @@ pub async fn login_route(body: Ruma<login::v3::Request>) -> Result<login::v3::Re
}) => {
debug!("Got appservice login type");
if !body.from_appservice {
info!(
"User tried logging in as an appservice, but request body is not from a known/registered \
appservice"
);
return Err(Error::BadRequest(ErrorKind::Forbidden, "Forbidden login type."));
return Err(Error::BadRequest(ErrorKind::MissingToken, "Missing Appservice token."));
};
let username = if let Some(UserIdentifier::UserIdOrLocalpart(user_id)) = identifier {
user_id.to_lowercase()