geforkt von mirrored/vaultwarden
Check email validity before using it for password hint sending
Dieser Commit ist enthalten in:
Ursprung
401aa7c699
Commit
9e63985b28
4 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen
|
@ -61,6 +61,7 @@ num-derive = "0.2.2"
|
|||
lettre = "0.8.2"
|
||||
lettre_email = "0.8.2"
|
||||
native-tls = "0.1.5"
|
||||
fast_chemail = "0.9.5"
|
||||
|
||||
[patch.crates-io]
|
||||
# Make jwt use ring 0.11, to match rocket
|
||||
|
|
|
@ -5,6 +5,7 @@ use db::models::*;
|
|||
|
||||
use api::{PasswordData, JsonResult, EmptyResult, JsonUpcase, NumberOrString};
|
||||
use auth::Headers;
|
||||
use fast_chemail::is_valid_email;
|
||||
use mail;
|
||||
|
||||
use CONFIG;
|
||||
|
@ -259,6 +260,10 @@ struct PasswordHintData {
|
|||
fn password_hint(data: JsonUpcase<PasswordHintData>, conn: DbConn) -> EmptyResult {
|
||||
let data: PasswordHintData = data.into_inner().data;
|
||||
|
||||
if !is_valid_email(&data.Email) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let user = User::find_by_mail(&data.Email, &conn);
|
||||
if user.is_none() {
|
||||
return Ok(());
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::error::Error;
|
||||
use native_tls::TlsConnector;
|
||||
use native_tls::{Protocol};
|
||||
use native_tls::{Protocol, TlsConnector};
|
||||
use lettre::{EmailTransport, SmtpTransport, ClientTlsParameters, ClientSecurity};
|
||||
use lettre::smtp::{ConnectionReuseParameters, SmtpTransportBuilder};
|
||||
use lettre::smtp::authentication::Credentials;
|
||||
|
|
|
@ -29,6 +29,7 @@ extern crate num_traits;
|
|||
extern crate lettre;
|
||||
extern crate lettre_email;
|
||||
extern crate native_tls;
|
||||
extern crate fast_chemail;
|
||||
|
||||
use std::{env, path::Path, process::{exit, Command}};
|
||||
use rocket::Rocket;
|
||||
|
|
Laden …
In neuem Issue referenzieren