diff --git a/src/api/core/two_factor/mod.rs b/src/api/core/two_factor/mod.rs index 74d5b1a288f..2be933f7828 100644 --- a/src/api/core/two_factor/mod.rs +++ b/src/api/core/two_factor/mod.rs @@ -176,8 +176,9 @@ pub async fn enforce_2fa_policy( .await .into_iter() { - // Policy only applies to non-Owner/non-Admin members who have accepted joining the org - if member.atype < UserOrgType::Admin { + // Don't enforce the policy for Admins and Owners + // Invited users will get an error when they try to accept the invite. + if member.atype < UserOrgType::Admin && member.status != UserOrgStatus::Invited as i32 { if CONFIG.mail_enabled() { let org = Organization::find_by_uuid(&member.org_uuid, conn).await.unwrap(); mail::send_2fa_removed_from_org(&user.email, &org.name).await?;