1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-05-20 02:23:56 +00:00

Merge pull request #555 from vverst/email-codes

Add Email 2FA login
This commit is contained in:
Daniel García 2019-08-27 21:07:41 +02:00 committed by GitHub
commit c07c9995ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 1674 additions and 1064 deletions

View file

@ -168,6 +168,19 @@ pub fn send_new_device_logged_in(address: &str, ip: &str, dt: &NaiveDateTime, de
send_email(&address, &subject, &body_html, &body_text)
}
pub fn send_token(address: &str, token: &str) -> EmptyResult {
let (subject, body_html, body_text) = get_text(
"email/twofactor_email",
json!({
"url": CONFIG.domain(),
"token": token,
}),
)?;
send_email(&address, &subject, &body_html, &body_text)
}
fn send_email(address: &str, subject: &str, body_html: &str, body_text: &str) -> EmptyResult {
let html = PartBuilder::new()
.body(encode_to_str(body_html))