Skip to content

Commit 9013f44

Browse files
committed
fix error when hashing passwords
1 parent 98c7c01 commit 9013f44

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/webserver/database/sql_pseudofunctions.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,11 @@ fn random_string(len: usize) -> String {
9898
}
9999

100100
fn hash_password(password: &str) -> anyhow::Result<String> {
101-
tokio::task::block_in_place(|| {
102-
let phf = argon2::Argon2::default();
103-
let salt = password_hash::SaltString::generate(&mut password_hash::rand_core::OsRng);
104-
let password_hash = &password_hash::PasswordHash::generate(phf, password, &salt)
105-
.map_err(|e| anyhow!("Unable to hash password: {}", e))?;
106-
Ok(password_hash.to_string())
107-
})
101+
let phf = argon2::Argon2::default();
102+
let salt = password_hash::SaltString::generate(&mut password_hash::rand_core::OsRng);
103+
let password_hash = &password_hash::PasswordHash::generate(phf, password, &salt)
104+
.map_err(|e| anyhow!("Unable to hash password: {}", e))?;
105+
Ok(password_hash.to_string())
108106
}
109107

110108
fn extract_basic_auth_username(request: &RequestInfo) -> anyhow::Result<&str> {

tests/index.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ async fn test_files_it_works() {
6363
}
6464
}
6565

66-
6766
async fn req_path(path: &str) -> Result<actix_web::dev::ServiceResponse, actix_web::Error> {
6867
init_log();
6968
let config = test_config();

0 commit comments

Comments
 (0)