vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit bbc6470f65137e663d362c71ab4636b1bdf2316d
parent 12075639f3fd78a59a8280f8e2ef77ab4ce139d0
Author: Daniel GarcĂ­a <dani-garcia@users.noreply.github.com>
Date:   Wed, 19 Oct 2022 20:40:24 +0200

Merge branch 'BlackDex-fix-password-hint'

Diffstat:
Msrc/api/core/accounts.rs | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/api/core/accounts.rs b/src/api/core/accounts.rs @@ -189,9 +189,8 @@ async fn profile(headers: Headers, conn: DbConn) -> Json<Value> { #[derive(Deserialize, Debug)] #[allow(non_snake_case)] struct ProfileData { - #[serde(rename = "Culture")] - _Culture: String, // Ignored, always use en-US - MasterPasswordHint: Option<String>, + // Culture: String, // Ignored, always use en-US + // MasterPasswordHint: Option<String>, // Ignored, has been moved to ChangePassData Name: String, } @@ -212,8 +211,6 @@ async fn post_profile(data: JsonUpcase<ProfileData>, headers: Headers, conn: DbC let mut user = headers.user; user.name = data.Name; - user.password_hint = clean_password_hint(&data.MasterPasswordHint); - enforce_password_hint_setting(&user.password_hint)?; user.save(&conn).await?; Ok(Json(user.to_json(&conn).await)) @@ -256,6 +253,7 @@ async fn post_keys(data: JsonUpcase<KeysData>, headers: Headers, conn: DbConn) - struct ChangePassData { MasterPasswordHash: String, NewMasterPasswordHash: String, + MasterPasswordHint: Option<String>, Key: String, } @@ -268,6 +266,9 @@ async fn post_password(data: JsonUpcase<ChangePassData>, headers: Headers, conn: err!("Invalid password") } + user.password_hint = clean_password_hint(&data.MasterPasswordHint); + enforce_password_hint_setting(&user.password_hint)?; + user.set_password( &data.NewMasterPasswordHash, Some(vec![String::from("post_rotatekey"), String::from("get_contacts"), String::from("get_public_keys")]),