Refactor users management
All checks were successful
continuous-integration/drone/push Build is passing

* Shard `src/data/user.rs` into two different files
  * One for user data structure (same file)
  * One for user manipulation (new file: `user_file_entity.rs`)
* Isolate password hashing and verification
This commit is contained in:
2022-11-19 17:52:35 +01:00
parent 75d894d648
commit 65d334b947
7 changed files with 145 additions and 113 deletions

View File

@ -103,7 +103,14 @@ pub async fn change_password_route(
);
} else if let Some(req) = req {
// Invalid password
if !user.verify_password(&req.old_pass) {
if !users
.send(users_actor::VerifyUserPasswordRequest(
user.uid.clone(),
req.old_pass.clone(),
))
.await
.unwrap()
{
danger = Some("Old password is invalid!".to_string());
bruteforce
.send(bruteforce_actor::RecordFailedAttempt {