Send broadcast message when an API token is deleted
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use crate::app_config::AppConfig;
|
||||
use crate::broadcast_messages::BroadcastSender;
|
||||
use crate::controllers::{HttpFailure, HttpResult};
|
||||
use crate::extractors::auth_extractor::{AuthExtractor, AuthenticatedMethod};
|
||||
use crate::extractors::matrix_client_extractor::MatrixClientExtractor;
|
||||
@@ -113,14 +114,18 @@ pub async fn auth_info(client: MatrixClientExtractor) -> HttpResult {
|
||||
}
|
||||
|
||||
/// Sign out user
|
||||
pub async fn sign_out(auth: AuthExtractor, session: MatrixGWSession) -> HttpResult {
|
||||
pub async fn sign_out(
|
||||
auth: AuthExtractor,
|
||||
session: MatrixGWSession,
|
||||
tx: web::Data<BroadcastSender>,
|
||||
) -> HttpResult {
|
||||
match auth.method {
|
||||
AuthenticatedMethod::Cookie => {
|
||||
session.unset_current_user()?;
|
||||
}
|
||||
|
||||
AuthenticatedMethod::Token(token) => {
|
||||
token.delete(&auth.user.email).await?;
|
||||
token.delete(&auth.user.email, &tx).await?;
|
||||
}
|
||||
|
||||
AuthenticatedMethod::Dev => {
|
||||
|
||||
Reference in New Issue
Block a user