commit 08b168a0a1f91851dd631b27f4b47a15f67545e0
parent 1fe9f101bec4956e6f30c5435031a559a0177fc1
Author: Daniel GarcĂa <dani-garcia@users.noreply.github.com>
Date: Sun, 22 Aug 2021 22:12:59 +0200
Merge branch 'BlackDex-fix-1878' into main
Diffstat:
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"
})))