fix(backend): Fix compilation errors in password recovery
Fixed issues: - PasswordService has no new() method, use static methods directly - Updated User model to use PasswordService::hash_password() directly - Updated handlers to import verify_password function - Fixed all password hashing and verification calls Compilation errors resolved: - error[E0599]: PasswordService::new() not found - error[E0277]: Handler trait not implemented for setup_recovery Files modified: - backend/src/models/user.rs - backend/src/handlers/auth.rs - backend/src/auth/jwt.rs
This commit is contained in:
parent
9d050fffbb
commit
440bfef4d2
2 changed files with 10 additions and 15 deletions
|
|
@ -10,6 +10,7 @@ use wither::bson::oid::ObjectId;
|
|||
|
||||
use crate::{
|
||||
auth::jwt::{Claims, JwtService},
|
||||
auth::password::verify_password,
|
||||
config::AppState,
|
||||
models::user::{User, UserRepository},
|
||||
};
|
||||
|
|
@ -221,7 +222,7 @@ pub async fn login(
|
|||
};
|
||||
|
||||
// Verify password
|
||||
match user.verify_password(&req.password) {
|
||||
match verify_password(&req.password, &user.password_hash) {
|
||||
Ok(true) => {}
|
||||
Ok(false) => {
|
||||
return Err((
|
||||
|
|
@ -493,7 +494,7 @@ pub async fn setup_recovery(
|
|||
};
|
||||
|
||||
// Verify current password
|
||||
match user.verify_password(&req.current_password) {
|
||||
match verify_password(&req.current_password, &user.password_hash) {
|
||||
Ok(true) => {}
|
||||
Ok(false) => {
|
||||
return Err((
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue