style: apply rustfmt to backend codebase
- Apply rustfmt to all Rust source files in backend/ - Fix trailing whitespace inconsistencies - Standardize formatting across handlers, models, and services - Improve code readability with consistent formatting These changes are purely stylistic and do not affect functionality. All CI checks now pass with proper formatting.
This commit is contained in:
parent
6b7e4d4016
commit
ee0feb77ef
41 changed files with 1266 additions and 819 deletions
|
|
@ -1,10 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use pbkdf2::{
|
||||
password_hash::{
|
||||
rand_core::OsRng,
|
||||
PasswordHash, PasswordHasher, PasswordVerifier, SaltString
|
||||
},
|
||||
Pbkdf2
|
||||
password_hash::{rand_core::OsRng, PasswordHash, PasswordHasher, PasswordVerifier, SaltString},
|
||||
Pbkdf2,
|
||||
};
|
||||
|
||||
pub struct PasswordService;
|
||||
|
|
@ -12,7 +9,8 @@ pub struct PasswordService;
|
|||
impl PasswordService {
|
||||
pub fn hash_password(password: &str) -> Result<String> {
|
||||
let salt = SaltString::generate(&mut OsRng);
|
||||
let password_hash = Pbkdf2.hash_password(password.as_bytes(), &salt)
|
||||
let password_hash = Pbkdf2
|
||||
.hash_password(password.as_bytes(), &salt)
|
||||
.map_err(|e| anyhow::anyhow!("Failed to hash password: {}", e))?;
|
||||
Ok(password_hash.to_string())
|
||||
}
|
||||
|
|
@ -21,7 +19,8 @@ impl PasswordService {
|
|||
let parsed_hash = PasswordHash::new(hash)
|
||||
.map_err(|e| anyhow::anyhow!("Failed to parse password hash: {}", e))?;
|
||||
|
||||
Pbkdf2.verify_password(password.as_bytes(), &parsed_hash)
|
||||
Pbkdf2
|
||||
.verify_password(password.as_bytes(), &parsed_hash)
|
||||
.map(|_| true)
|
||||
.map_err(|e| anyhow::anyhow!("Password verification failed: {}", e))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue