Can disconnect user from UI

This commit is contained in:
2025-11-06 21:33:09 +01:00
parent 8bbbe7022f
commit 70a246355b
4 changed files with 62 additions and 2 deletions

View File

@@ -1,7 +1,10 @@
use crate::controllers::HttpResult;
use crate::extractors::auth_extractor::AuthExtractor;
use crate::extractors::matrix_client_extractor::MatrixClientExtractor;
use crate::matrix_connection::matrix_client::FinishMatrixAuth;
use actix_web::HttpResponse;
use crate::matrix_connection::matrix_manager::MatrixManagerMsg;
use actix_web::{HttpResponse, web};
use ractor::ActorRef;
#[derive(serde::Serialize)]
struct StartAuthResponse {
@@ -28,3 +31,15 @@ pub async fn finish_auth(client: MatrixClientExtractor) -> HttpResult {
}
}
}
/// Logout user from Matrix server
pub async fn logout(
auth: AuthExtractor,
manager: web::Data<ActorRef<MatrixManagerMsg>>,
) -> HttpResult {
manager
.cast(MatrixManagerMsg::DisconnectClient(auth.user.email))
.expect("Failed to communicate with matrix manager!");
Ok(HttpResponse::Ok().finish())
}