aboutsummaryrefslogtreecommitdiffstats
path: root/crates/rocie-server/src/storage/sql
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--crates/rocie-server/src/storage/sql/user.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/crates/rocie-server/src/storage/sql/user.rs b/crates/rocie-server/src/storage/sql/user.rs
index dd0cf06..14fbfcc 100644
--- a/crates/rocie-server/src/storage/sql/user.rs
+++ b/crates/rocie-server/src/storage/sql/user.rs
@@ -10,10 +10,7 @@
use std::fmt::Display;
-use argon2::{
- Argon2, PasswordHasher, PasswordVerifier,
- password_hash::{SaltString, rand_core::OsRng},
-};
+use argon2::{Argon2, PasswordHasher, PasswordVerifier};
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
@@ -58,12 +55,10 @@ impl PasswordHash {
}
pub(crate) fn from_password(password: &str) -> Self {
- let salt = SaltString::generate(&mut OsRng);
-
let argon2 = Argon2::default();
let password_hash = argon2
- .hash_password(password.as_bytes(), &salt)
+ .hash_password(password.as_bytes())
.expect("to not fail")
.to_string();
@@ -81,7 +76,7 @@ impl PasswordHash {
.is_ok()
}
- fn as_argon_hash(&self) -> argon2::PasswordHash<'_> {
+ fn as_argon_hash(&self) -> argon2::PasswordHash {
argon2::PasswordHash::new(&self.value)
.expect("to be valid, as we are just deserializing a previously serialize value")
}