mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-07-16 09:11:12 +00:00
enforce 2FA policy on removal of second factor and login (#3803)
* enforce 2fa policy on removal of second factor users should be revoked when their second factors are removed. we want to revoke users so they don't have to be invited again and organization admins and owners are aware that they no longer have access. we make an exception for non-confirmed users to speed up the invitation process as they would have to be restored before they can accept their invitation or be confirmed. if email is enabled, invited users have to add a second factor before they can accept the invitation to an organization with 2fa policy. and if it is not enabled that check is done when confirming the user. * use &str instead of String in log_event() * enforce the 2fa policy on login if a user doesn't have a second factor check if they are in an organization that has the 2fa policy enabled to revoke their access
This commit is contained in:
parent
d672ad3f76
commit
2c36993792
7 changed files with 163 additions and 122 deletions
|
@ -510,7 +510,7 @@ pub async fn update_cipher_from_data(
|
|||
event_type as i32,
|
||||
&cipher.uuid,
|
||||
org_uuid,
|
||||
headers.user.uuid.clone(),
|
||||
&headers.user.uuid,
|
||||
headers.device.atype,
|
||||
&headers.ip.ip,
|
||||
conn,
|
||||
|
@ -791,7 +791,7 @@ async fn post_collections_admin(
|
|||
EventType::CipherUpdatedCollections as i32,
|
||||
&cipher.uuid,
|
||||
&cipher.organization_uuid.unwrap(),
|
||||
headers.user.uuid.clone(),
|
||||
&headers.user.uuid,
|
||||
headers.device.atype,
|
||||
&headers.ip.ip,
|
||||
&mut conn,
|
||||
|
@ -1145,7 +1145,7 @@ async fn save_attachment(
|
|||
EventType::CipherAttachmentCreated as i32,
|
||||
&cipher.uuid,
|
||||
org_uuid,
|
||||
headers.user.uuid.clone(),
|
||||
&headers.user.uuid,
|
||||
headers.device.atype,
|
||||
&headers.ip.ip,
|
||||
&mut conn,
|
||||
|
@ -1479,7 +1479,7 @@ async fn delete_all(
|
|||
EventType::OrganizationPurgedVault as i32,
|
||||
&org_data.org_id,
|
||||
&org_data.org_id,
|
||||
user.uuid,
|
||||
&user.uuid,
|
||||
headers.device.atype,
|
||||
&headers.ip.ip,
|
||||
&mut conn,
|
||||
|
@ -1560,16 +1560,8 @@ async fn _delete_cipher_by_uuid(
|
|||
false => EventType::CipherDeleted as i32,
|
||||
};
|
||||
|
||||
log_event(
|
||||
event_type,
|
||||
&cipher.uuid,
|
||||
&org_uuid,
|
||||
headers.user.uuid.clone(),
|
||||
headers.device.atype,
|
||||
&headers.ip.ip,
|
||||
conn,
|
||||
)
|
||||
.await;
|
||||
log_event(event_type, &cipher.uuid, &org_uuid, &headers.user.uuid, headers.device.atype, &headers.ip.ip, conn)
|
||||
.await;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -1629,7 +1621,7 @@ async fn _restore_cipher_by_uuid(uuid: &str, headers: &Headers, conn: &mut DbCon
|
|||
EventType::CipherRestored as i32,
|
||||
&cipher.uuid.clone(),
|
||||
org_uuid,
|
||||
headers.user.uuid.clone(),
|
||||
&headers.user.uuid,
|
||||
headers.device.atype,
|
||||
&headers.ip.ip,
|
||||
conn,
|
||||
|
@ -1713,7 +1705,7 @@ async fn _delete_cipher_attachment_by_id(
|
|||
EventType::CipherAttachmentDeleted as i32,
|
||||
&cipher.uuid,
|
||||
&org_uuid,
|
||||
headers.user.uuid.clone(),
|
||||
&headers.user.uuid,
|
||||
headers.device.atype,
|
||||
&headers.ip.ip,
|
||||
conn,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue