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 881d1f43340b16cfa6b9836b520537461397c1d3
parent c6664971300a360a82b42db1bcf0a7d883717fff
Author: BlackDex <black.dex@gmail.com>
Date:   Thu, 19 Aug 2021 09:25:34 +0200

Fix wrong display of MFA email.

There was some wrong logic regarding the display of which email is
configured to be used for the email MFA. This is now fixed.

Resolves #1878

Diffstat:
Msrc/api/core/two_factor/email.rs | 12+++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/api/core/two_factor/email.rs b/src/api/core/two_factor/email.rs @@ -80,14 +80,16 @@ fn get_email(data: JsonUpcase<PasswordData>, headers: Headers, conn: DbConn) -> err!("Invalid password"); } - let type_ = TwoFactorType::Email as i32; - let enabled = match TwoFactor::find_by_user_and_type(&user.uuid, type_, &conn) { - Some(x) => x.enabled, - _ => false, + let (enabled, mfa_email) = match TwoFactor::find_by_user_and_type(&user.uuid, TwoFactorType::Email as i32, &conn) { + Some(x) => { + let twofactor_data = EmailTokenData::from_json(&x.data)?; + (true, json!(twofactor_data.email)) + } + _ => (false, json!(null)), }; Ok(Json(json!({ - "Email": user.email, + "Email": mfa_email, "Enabled": enabled, "Object": "twoFactorEmail" })))