diff options
| author | Soispha Peetz <soispha@b-peetz.de> | 2026-11-13 22:50:22 +0100 |
|---|---|---|
| committer | Soispha Peetz <soispha@b-peetz.de> | 2026-11-13 22:50:22 +0100 |
| commit | d0780853a46aedb174a1fce6a66c55c4a926c93e (patch) | |
| tree | 7ae94b41d5a0ae52f0765a160b93bae5703369ad /crates/rocie-server/src | |
| parent | build(Cargo.{lock,toml},flake.lock): Update (diff) | |
| download | server-d0780853a46aedb174a1fce6a66c55c4a926c93e.zip | |
build(Cargo.{lock,toml},flake.lock): Update
Diffstat (limited to '')
| -rw-r--r-- | crates/rocie-server/src/storage/sql/user.rs | 11 |
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") } |
