1
0
Fork 0

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
Dieser Commit ist enthalten in:
BlackDex 2021-08-19 09:25:34 +02:00
Ursprung c666497130
Commit 881d1f4334

Datei anzeigen

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