Can clear 2FA login history from edit_user page

This commit is contained in:
2022-11-12 11:16:55 +01:00
parent 7a3eaa944e
commit 7e1cbb184d
6 changed files with 226 additions and 10 deletions

View File

@ -60,6 +60,7 @@ pub struct UpdateUserQuery {
grant_type: String,
granted_clients: String,
two_factor: String,
clear_2fa_history: Option<String>,
}
pub async fn users_route(
@ -114,10 +115,15 @@ pub async fn users_route(
let temp_pass = rand_str(TEMPORARY_PASSWORDS_LEN);
user.password = hash_password(&temp_pass).expect("Failed to hash password");
user.need_reset_password = true;
user.last_successful_2fa = Default::default();
Some(temp_pass)
}
};
if update.0.clear_2fa_history.is_some() {
user.last_successful_2fa = Default::default();
}
let res = users
.send(users_actor::UpdateUserRequest(user.clone()))
.await