aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMathijs van Veluw <[email protected]>2024-02-08 22:16:29 +0100
committerGitHub <[email protected]>2024-02-08 22:16:29 +0100
commitb9bdc9b8e227b556e6744c675a259b29d9e277db (patch)
tree203c5bf594ad5dff46c4210c5433f49566cc7276 /src
parent897bdf8343148ee4e4f1a937cbc501ad3f743b4a (diff)
downloadvaultwarden-b9bdc9b8e227b556e6744c675a259b29d9e277db.tar.gz
vaultwarden-b9bdc9b8e227b556e6744c675a259b29d9e277db.zip
Update Rust, crates and web-vault (#4328)
- Updated Rust to v1.76.0 - Updated crates - Updated web-vault to v2024.1.2b - Fixed some Clippy lints - Moved lint check configuration Cargo.toml - Fixed issue with Reset Password Enrollment when logged-in via device
Diffstat (limited to 'src')
-rw-r--r--src/api/core/events.rs2
-rw-r--r--src/api/core/organizations.rs15
-rw-r--r--src/main.rs31
3 files changed, 8 insertions, 40 deletions
diff --git a/src/api/core/events.rs b/src/api/core/events.rs
index 9a2027e0..d7aaeb4a 100644
--- a/src/api/core/events.rs
+++ b/src/api/core/events.rs
@@ -125,7 +125,7 @@ async fn get_user_events(
})))
}
-fn get_continuation_token(events_json: &Vec<Value>) -> Option<&str> {
+fn get_continuation_token(events_json: &[Value]) -> Option<&str> {
// When the length of the vec equals the max page_size there probably is more data
// When it is less, then all events are loaded.
if events_json.len() as i64 == Event::PAGE_SIZE {
diff --git a/src/api/core/organizations.rs b/src/api/core/organizations.rs
index 5e6fe7d5..f3d39849 100644
--- a/src/api/core/organizations.rs
+++ b/src/api/core/organizations.rs
@@ -2659,6 +2659,7 @@ async fn delete_group_user(
struct OrganizationUserResetPasswordEnrollmentRequest {
ResetPasswordKey: Option<String>,
MasterPasswordHash: Option<String>,
+ Otp: Option<String>,
}
#[derive(Deserialize)]
@@ -2841,14 +2842,12 @@ async fn put_reset_password_enrollment(
}
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"),
- };
+ PasswordOrOtpData {
+ MasterPasswordHash: reset_request.MasterPasswordHash,
+ Otp: reset_request.Otp,
+ }
+ .validate(&headers.user, true, &mut conn)
+ .await?;
}
org_user.reset_password_key = reset_request.ResetPasswordKey;
diff --git a/src/main.rs b/src/main.rs
index 60b6cf5f..05f43c5a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,34 +1,3 @@
-#![forbid(unsafe_code, non_ascii_idents)]
-#![deny(
- rust_2018_idioms,
- rust_2021_compatibility,
- noop_method_call,
- pointer_structural_match,
- trivial_casts,
- trivial_numeric_casts,
- unused_import_braces,
- clippy::cast_lossless,
- clippy::clone_on_ref_ptr,
- clippy::equatable_if_let,
- clippy::float_cmp_const,
- clippy::inefficient_to_string,
- clippy::iter_on_empty_collections,
- clippy::iter_on_single_items,
- clippy::linkedlist,
- clippy::macro_use_imports,
- clippy::manual_assert,
- clippy::manual_instant_elapsed,
- clippy::manual_string_new,
- clippy::match_wildcard_for_single_variants,
- clippy::mem_forget,
- clippy::string_add_assign,
- clippy::string_to_string,
- clippy::unnecessary_join,
- clippy::unnecessary_self_imports,
- clippy::unused_async,
- clippy::verbose_file_reads,
- clippy::zero_sized_map_values
-)]
#![cfg_attr(feature = "unstable", feature(ip))]
// The recursion_limit is mainly triggered by the json!() macro.
// The more key/value pairs there are the more recursion occurs.