fix api/client_server/session events

And also add a new event for logging out to match the one for logging in
because why not.
This commit is contained in:
Charles Hall 2024-07-15 17:56:43 -07:00
parent 0aef00c58b
commit 60b89aba78
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF

View file

@ -79,7 +79,7 @@ pub(crate) async fn login_route(
} else if let Some(user) = user {
UserId::parse(user)
} else {
warn!("Bad login type: {:?}", &body.login_info);
warn!(kind = ?body.login_info, "Bad login kind");
return Err(Error::BadRequest(
ErrorKind::forbidden(),
"Bad login type.",
@ -184,7 +184,7 @@ pub(crate) async fn login_route(
} else if let Some(user) = user {
UserId::parse(user)
} else {
warn!("Bad login type: {:?}", &body.login_info);
warn!(kind = ?body.login_info, "Bad login kind");
return Err(Error::BadRequest(
ErrorKind::forbidden(),
"Bad login type.",
@ -214,7 +214,7 @@ pub(crate) async fn login_route(
user_id
}
_ => {
warn!("Unsupported or unknown login type: {:?}", &body.login_info);
warn!(kind = ?body.login_info, "Unsupported or unknown login kind");
return Err(Error::BadRequest(
ErrorKind::Unknown,
"Unsupported login type.",
@ -250,7 +250,7 @@ pub(crate) async fn login_route(
)?;
}
info!("{} logged in", user_id);
info!(%user_id, %device_id, "User logged in");
// Homeservers are still required to send the `home_server` field
#[allow(deprecated)]
@ -292,6 +292,8 @@ pub(crate) async fn logout_route(
services().users.remove_device(sender_user, sender_device)?;
info!(user_id = %sender_user, device_id = %sender_device, "User logged out");
Ok(Ra(logout::v3::Response::new()))
}