From f5916ec396329a1239641944ebcf2b9e42656179 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Thu, 30 Jan 2020 22:33:50 +0100 Subject: [PATCH] Fix backwards indices --- src/api/core/two_factor/email.rs | 4 ++-- src/mail.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/api/core/two_factor/email.rs b/src/api/core/two_factor/email.rs index e012ec38..e68e998c 100644 --- a/src/api/core/two_factor/email.rs +++ b/src/api/core/two_factor/email.rs @@ -273,8 +273,8 @@ impl EmailTokenData { pub fn obscure_email(email: &str) -> String { let split: Vec<&str> = email.rsplitn(2, '@').collect(); - let mut name = split[0].to_string(); - let domain = &split[1]; + let mut name = split[1].to_string(); + let domain = &split[0]; let name_size = name.chars().count(); diff --git a/src/mail.rs b/src/mail.rs index 014b0e51..6e49f8f5 100644 --- a/src/mail.rs +++ b/src/mail.rs @@ -264,12 +264,12 @@ fn send_email(address: &str, subject: &str, body_html: &str, body_text: &str) -> err!("Invalid email address (no @)"); } - let domain_puny = match idna::domain_to_ascii_strict(address_split[1]) { + let domain_puny = match idna::domain_to_ascii_strict(address_split[0]) { Ok(d) => d, Err(_) => err!("Can't convert email domain to ASCII representation"), }; - let address = format!("{}@{}", address_split[0], domain_puny); + let address = format!("{}@{}", address_split[1], domain_puny); let html = PartBuilder::new() .body(encode_to_str(body_html))