mirror of
https://github.com/element-hq/matrix-authentication-service.git
synced 2026-04-27 06:25:42 +00:00
Remove user emails when deactivating a user
This commit is contained in:
@@ -11,7 +11,7 @@ use mas_storage::{
|
||||
compat::CompatSessionFilter,
|
||||
oauth2::OAuth2SessionFilter,
|
||||
queue::{DeactivateUserJob, ReactivateUserJob},
|
||||
user::{BrowserSessionFilter, UserRepository},
|
||||
user::{BrowserSessionFilter, UserEmailFilter, UserRepository},
|
||||
};
|
||||
use tracing::info;
|
||||
|
||||
@@ -81,6 +81,14 @@ impl RunnableJob for DeactivateUserJob {
|
||||
.map_err(JobError::retry)?;
|
||||
info!(affected = n, "Killed all compatibility sessions for user");
|
||||
|
||||
// Delete all the email addresses for the user
|
||||
let n = repo
|
||||
.user_email()
|
||||
.remove_bulk(UserEmailFilter::new().for_user(&user))
|
||||
.await
|
||||
.map_err(JobError::retry)?;
|
||||
info!(affected = n, "Removed all email addresses for user");
|
||||
|
||||
// Before calling back to the homeserver, commit the changes to the database, as
|
||||
// we want the user to be locked out as soon as possible
|
||||
repo.save().await.map_err(JobError::retry)?;
|
||||
|
||||
Reference in New Issue
Block a user