1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-06-11 05:23:53 +00:00

Use user_uuid instead of mut twofactor

This commit is contained in:
vpl 2019-10-15 21:19:27 +02:00
parent 18bc8331f9
commit 2edecf34ff
2 changed files with 8 additions and 7 deletions

View file

@ -295,14 +295,14 @@ fn _json_err_twofactor(providers: &[i32], user_uuid: &str, conn: &DbConn) -> Api
Some(tf_type @ TwoFactorType::Email) => {
use crate::api::core::two_factor as _tf;
let mut twofactor = match TwoFactor::find_by_user_and_type(user_uuid, tf_type as i32, &conn) {
let twofactor = match TwoFactor::find_by_user_and_type(user_uuid, tf_type as i32, &conn) {
Some(tf) => tf,
None => err!("No twofactor email registered"),
};
// Send email immediately if email is the only 2FA option
if providers.len() == 1 {
_tf::email::prepare_send_token(&mut twofactor, &conn)?
_tf::email::send_token(&user_uuid, &conn)?
}
let email_data = EmailTokenData::from_json(&twofactor.data)?;