Replace Option<SecondFactor> with SecondFactor

This commit is contained in:
2022-04-19 17:56:53 +02:00
parent 5903ec2e8c
commit 9ff4392afb
4 changed files with 11 additions and 17 deletions

View File

@ -81,10 +81,9 @@ pub async fn users_route(user: CurrentUser, users: web::Data<Addr<UsersActor>>,
user.enabled = update.0.enabled.is_some();
user.admin = update.0.admin.is_some();
if let Some(factors) = user.two_factor.as_mut() {
let factors_to_keep = update.0.two_factor.split(';').collect::<Vec<_>>();
factors.retain(|f| factors_to_keep.contains(&f.id.0.as_str()));
}
let factors_to_keep = update.0.two_factor.split(';').collect::<Vec<_>>();
user.two_factor.retain(|f| factors_to_keep.contains(&f.id.0.as_str()));
user.authorized_clients = match update.0.grant_type.as_str() {
"all_clients" => None,