Updated client kdf iterations to 100000 and fixed some lints

This commit is contained in:
Daniel García
2019-09-05 21:56:12 +02:00
parent dda244edd8
commit df8114f8be
7 changed files with 105 additions and 116 deletions
Generated
+93 -103
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -34,7 +34,7 @@ multipart = { version = "0.16.1", features = ["server"], default-features = fals
ws = "0.9.0"
# MessagePack library
rmpv = "0.4.0"
rmpv = "0.4.1"
# Concurrent hashmap implementation
chashmap = "2.2.2"
@@ -62,7 +62,7 @@ ring = "0.14.6"
uuid = { version = "0.7.4", features = ["v4"] }
# Date and time library for Rust
chrono = "0.4.7"
chrono = "0.4.9"
# TOTP library
oath = "0.10.2"
@@ -99,18 +99,18 @@ native-tls = "0.2.3"
quoted_printable = "0.4.1"
# Template library
handlebars = "2.0.1"
handlebars = "2.0.2"
# For favicon extraction from main website
soup = "0.4.1"
regex = "1.2.1"
regex = "1.3.1"
# URL encoding library
percent-encoding = "2.1.0"
[patch.crates-io]
# Add support for Timestamp type
rmp = { git = 'https://github.com/dani-garcia/msgpack-rust' }
rmp = { git = 'https://github.com/dani-garcia/msgpack-rust', branch='ext_types' }
# Use newest ring
rocket = { git = 'https://github.com/SergioBenitez/Rocket', rev = 'dbcb0a75b9556763ac3ab708f40c8f8ed75f1a1e' }
@@ -4,4 +4,4 @@ ALTER TABLE users
ALTER TABLE users
ADD COLUMN
client_kdf_iter INTEGER NOT NULL DEFAULT 5000;
client_kdf_iter INTEGER NOT NULL DEFAULT 100000;
@@ -4,4 +4,4 @@ ALTER TABLE users
ALTER TABLE users
ADD COLUMN
client_kdf_iter INTEGER NOT NULL DEFAULT 5000;
client_kdf_iter INTEGER NOT NULL DEFAULT 100000;
+2 -2
View File
@@ -263,7 +263,7 @@ impl EmailTokenData {
}
pub fn add_attempt(&mut self) {
self.attempts = self.attempts + 1;
self.attempts += 1;
}
pub fn to_json(&self) -> String {
@@ -281,7 +281,7 @@ impl EmailTokenData {
/// Takes an email address and obscures it by replacing it with asterisks except two characters.
pub fn obscure_email(email: &str) -> String {
let split: Vec<&str> = email.split("@").collect();
let split: Vec<&str> = email.split('@').collect();
let mut name = split[0].to_string();
let domain = &split[1];
+1 -1
View File
@@ -46,7 +46,7 @@ enum UserStatus {
/// Local methods
impl User {
pub const CLIENT_KDF_TYPE_DEFAULT: i32 = 0; // PBKDF2: 0
pub const CLIENT_KDF_ITER_DEFAULT: i32 = 5_000;
pub const CLIENT_KDF_ITER_DEFAULT: i32 = 100_000;
pub fn new(mail: String) -> Self {
let now = Utc::now().naive_utc();
+2 -3
View File
@@ -45,9 +45,9 @@ fn mailer() -> SmtpTransport {
let auth_mechanism = serde_json::from_str::<SmtpAuthMechanism>(&auth_mechanism_json);
match auth_mechanism {
Ok(auth_mechanism) => smtp_client.authentication_mechanism(auth_mechanism),
Err(_) => panic!("Failure to parse mechanism. Is it proper Json? Eg. `\"Plain\"` not `Plain`"),
_ => panic!("Failure to parse mechanism. Is it proper Json? Eg. `\"Plain\"` not `Plain`"),
}
},
}
_ => smtp_client,
};
@@ -169,7 +169,6 @@ pub fn send_new_device_logged_in(address: &str, ip: &str, dt: &NaiveDateTime, de
}
pub fn send_token(address: &str, token: &str) -> EmptyResult {
let (subject, body_html, body_text) = get_text(
"email/twofactor_email",
json!({