Spiegel von
https://github.com/dani-garcia/vaultwarden.git
synchronisiert 2024-11-22 05:10:29 +01:00
added password check for manual reset
password enrollment endpoint
Dieser Commit ist enthalten in:
Ursprung
19e671ff25
Commit
9876aedd67
1 geänderte Dateien mit 15 neuen und 2 gelöschten Zeilen
|
@ -2668,6 +2668,7 @@ async fn delete_group_user(
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
struct OrganizationUserResetPasswordEnrollmentRequest {
|
struct OrganizationUserResetPasswordEnrollmentRequest {
|
||||||
ResetPasswordKey: Option<String>,
|
ResetPasswordKey: Option<String>,
|
||||||
|
MasterPasswordHash: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
@ -2849,6 +2850,19 @@ async fn put_reset_password_enrollment(
|
||||||
err!("Reset password can't be withdrawed due to an enterprise policy");
|
err!("Reset password can't be withdrawed due to an enterprise policy");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let user = headers.user;
|
||||||
|
|
||||||
|
if reset_request.ResetPasswordKey.is_some() {
|
||||||
|
match reset_request.MasterPasswordHash {
|
||||||
|
Some(password) => {
|
||||||
|
if !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.reset_password_key = reset_request.ResetPasswordKey;
|
||||||
org_user.save(&mut conn).await?;
|
org_user.save(&mut conn).await?;
|
||||||
|
|
||||||
|
@ -2858,8 +2872,7 @@ async fn put_reset_password_enrollment(
|
||||||
EventType::OrganizationUserResetPasswordWithdraw as i32
|
EventType::OrganizationUserResetPasswordWithdraw as i32
|
||||||
};
|
};
|
||||||
|
|
||||||
log_event(log_id, org_user_id, org_id, headers.user.uuid.clone(), headers.device.atype, &headers.ip.ip, &mut conn)
|
log_event(log_id, org_user_id, org_id, user.uuid.clone(), headers.device.atype, &headers.ip.ip, &mut conn).await;
|
||||||
.await;
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Laden …
In neuem Issue referenzieren