diff --git a/src/api/core/organizations.rs b/src/api/core/organizations.rs index bd08080c..cd5455d2 100644 --- a/src/api/core/organizations.rs +++ b/src/api/core/organizations.rs @@ -2675,6 +2675,7 @@ async fn delete_group_user( #[allow(non_snake_case)] struct OrganizationUserResetPasswordEnrollmentRequest { ResetPasswordKey: Option, + MasterPasswordHash: Option, } #[derive(Deserialize)] @@ -2856,6 +2857,17 @@ async fn put_reset_password_enrollment( err!("Reset password can't be withdrawed due to an enterprise policy"); } + if reset_request.ResetPasswordKey.is_some() { + match reset_request.MasterPasswordHash { + Some(password) => { + if !headers.user.check_valid_password(&password) { + err!("Invalid or wrong password") + } + } + None => err!("No password provided"), + }; + } + org_user.reset_password_key = reset_request.ResetPasswordKey; org_user.save(&mut conn).await?;