fix: deactivate accounts that should be deactivated
This commit is contained in:
parent
bff68e595b
commit
88cf043f94
5 changed files with 91 additions and 44 deletions
|
@ -11,7 +11,7 @@ pub mod transaction_ids;
|
|||
pub mod uiaa;
|
||||
pub mod users;
|
||||
|
||||
use crate::{Error, Result};
|
||||
use crate::{utils, Error, Result};
|
||||
use directories::ProjectDirs;
|
||||
use futures::StreamExt;
|
||||
use log::{error, info};
|
||||
|
@ -246,6 +246,25 @@ impl Database {
|
|||
info!("Migration: 0 -> 1 finished");
|
||||
}
|
||||
|
||||
if db.globals.database_version()? < 2 {
|
||||
// We accidentally inserted hashed versions of "" into the db instead of just ""
|
||||
for userid_password in db.users.userid_password.iter() {
|
||||
let (userid, password) = userid_password?;
|
||||
|
||||
let password = utils::string_from_bytes(&password);
|
||||
|
||||
if password.map_or(false, |password| {
|
||||
argon2::verify_encoded(&password, b"").unwrap_or(false)
|
||||
}) {
|
||||
db.users.userid_password.insert(userid, b"")?;
|
||||
}
|
||||
}
|
||||
|
||||
db.globals.bump_database_version(2)?;
|
||||
|
||||
info!("Migration: 1 -> 2 finished");
|
||||
}
|
||||
|
||||
// This data is probably outdated
|
||||
db.rooms.edus.presenceid_presence.clear()?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue