Formatting

This commit is contained in:
Daniel García 2019-04-26 22:08:26 +02:00
parent eadab2e9ca
commit 874f5c34bd
No known key found for this signature in database
GPG Key ID: FC8A7D14C3CD543A
6 changed files with 18 additions and 14 deletions

View File

@ -877,7 +877,13 @@ struct OrganizationId {
} }
#[post("/ciphers/purge?<organization..>", data = "<data>")] #[post("/ciphers/purge?<organization..>", data = "<data>")]
fn delete_all(organization: Option<Form<OrganizationId>>, data: JsonUpcase<PasswordData>, headers: Headers, conn: DbConn, nt: Notify) -> EmptyResult { fn delete_all(
organization: Option<Form<OrganizationId>>,
data: JsonUpcase<PasswordData>,
headers: Headers,
conn: DbConn,
nt: Notify,
) -> EmptyResult {
let data: PasswordData = data.into_inner().data; let data: PasswordData = data.into_inner().data;
let password_hash = data.MasterPasswordHash; let password_hash = data.MasterPasswordHash;
@ -903,7 +909,7 @@ fn delete_all(organization: Option<Form<OrganizationId>>, data: JsonUpcase<Passw
} }
} }
} }
}, }
None => { None => {
// No organization ID in query params, purging user vault // No organization ID in query params, purging user vault
// Delete ciphers and their attachments // Delete ciphers and their attachments
@ -919,7 +925,7 @@ fn delete_all(organization: Option<Form<OrganizationId>>, data: JsonUpcase<Passw
user.update_revision(&conn)?; user.update_revision(&conn)?;
nt.send_user_update(UpdateType::Vault, &user); nt.send_user_update(UpdateType::Vault, &user);
Ok(()) Ok(())
}, }
} }
} }

View File

@ -734,7 +734,6 @@ impl DuoData {
}), }),
None => None, None => None,
} }
} }
fn msg(s: &str) -> Self { fn msg(s: &str) -> Self {
Self { Self {
@ -762,7 +761,6 @@ impl DuoData {
} }
} }
enum DuoStatus { enum DuoStatus {
Global(DuoData), // Using the global duo config Global(DuoData), // Using the global duo config
User(DuoData), // Using the user's config User(DuoData), // Using the user's config
@ -912,7 +910,6 @@ const APP_PREFIX: &str = "APP";
use chrono::Utc; use chrono::Utc;
fn get_user_duo_data(uuid: &str, conn: &DbConn) -> DuoStatus { fn get_user_duo_data(uuid: &str, conn: &DbConn) -> DuoStatus {
let type_ = TwoFactorType::Duo as i32; let type_ = TwoFactorType::Duo as i32;
@ -940,7 +937,7 @@ fn get_user_duo_data(uuid: &str, conn: &DbConn) -> DuoStatus {
fn get_duo_keys_email(email: &str, conn: &DbConn) -> ApiResult<(String, String, String, String)> { fn get_duo_keys_email(email: &str, conn: &DbConn) -> ApiResult<(String, String, String, String)> {
let data = User::find_by_mail(email, &conn) let data = User::find_by_mail(email, &conn)
.and_then(|u| get_user_duo_data(&u.uuid, &conn).data()) .and_then(|u| get_user_duo_data(&u.uuid, &conn).data())
.or_else(|| DuoData::global()) .or_else(DuoData::global)
.map_res("Can't fetch Duo keys")?; .map_res("Can't fetch Duo keys")?;
Ok((data.ik, data.sk, CONFIG.get_duo_akey(), data.host)) Ok((data.ik, data.sk, CONFIG.get_duo_akey(), data.host))

View File

@ -2,7 +2,7 @@
// PBKDF2 derivation // PBKDF2 derivation
// //
use ring::{digest, pbkdf2, hmac}; use ring::{digest, hmac, pbkdf2};
static DIGEST_ALG: &digest::Algorithm = &digest::SHA256; static DIGEST_ALG: &digest::Algorithm = &digest::SHA256;
const OUTPUT_LEN: usize = digest::SHA256_OUTPUT_LEN; const OUTPUT_LEN: usize = digest::SHA256_OUTPUT_LEN;

View File

@ -1,7 +1,7 @@
use lettre::smtp::authentication::Credentials; use lettre::smtp::authentication::Credentials;
use lettre::smtp::ConnectionReuseParameters; use lettre::smtp::ConnectionReuseParameters;
use lettre::{ClientSecurity, ClientTlsParameters, SmtpClient, SmtpTransport, Transport}; use lettre::{ClientSecurity, ClientTlsParameters, SmtpClient, SmtpTransport, Transport};
use lettre_email::{EmailBuilder,PartBuilder,MimeMultipartType}; use lettre_email::{EmailBuilder, MimeMultipartType, PartBuilder};
use native_tls::{Protocol, TlsConnector}; use native_tls::{Protocol, TlsConnector};
use quoted_printable::encode_to_str; use quoted_printable::encode_to_str;

View File

@ -91,7 +91,8 @@ fn init_logging() -> Result<(), fern::InitError> {
logger = logger.chain(fern::log_file(log_file)?); logger = logger.chain(fern::log_file(log_file)?);
} }
#[cfg(not(windows))] { #[cfg(not(windows))]
{
if cfg!(feature = "enable_syslog") || CONFIG.use_syslog() { if cfg!(feature = "enable_syslog") || CONFIG.use_syslog() {
logger = chain_syslog(logger); logger = chain_syslog(logger);
} }