1
0
Fork 0

Check email validity before using it for password hint sending

Dieser Commit ist enthalten in:
Jean-Christophe BEGUE 2018-08-15 17:25:59 +02:00 committet von Jean-Christophe BEGUE
Ursprung 401aa7c699
Commit 9e63985b28
4 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -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

Datei anzeigen

@ -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(());

Datei anzeigen

@ -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;

Datei anzeigen

@ -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;