Simplifying code
All checks were successful
Rust Build / Check (pull_request) Successful in 46s
Rust Build / Test Suite (pull_request) Successful in 1m6s
Rust Build / Rustfmt (pull_request) Successful in 32s
Rust Build / Clippy (pull_request) Successful in 47s
Rust Build / build (pull_request) Successful in 1m14s

This commit is contained in:
2025-04-07 12:27:21 -04:00
parent f601442f0e
commit e19f71fd1c

View File

@@ -49,18 +49,9 @@ pub mod endpoint {
};
// Check if user exists
match repo::user::exists(&pool, &usr.username).await {
Ok(exists) => {
if !exists {
return not_found("Not Found").await;
}
}
Err(err) => {
return not_found(&err.to_string()).await;
}
};
let user = repo::user::get(&pool, &usr.username).await.unwrap();
// match repo::user::exists(&pool, &usr.username).await {
match repo::user::get(&pool, &usr.username).await {
Ok(user) => {
let salt = repo::salt::get(&pool, &user.salt_id).await.unwrap();
let salt_str = hashing::get_salt(&salt.salt).unwrap();
@@ -70,7 +61,8 @@ pub mod endpoint {
if hashing::verify_password(&usr.password, hash_password.clone()).unwrap() {
// Create token
let key = token_stuff::get_key().unwrap();
let (token_literal, duration) = token_stuff::create_token(&key).unwrap();
let (token_literal, duration) =
token_stuff::create_token(&key).unwrap();
if token_stuff::verify_token(&key, &token_literal) {
(
@@ -98,4 +90,11 @@ pub mod endpoint {
}
}
}
Err(err) => {
return not_found(&err.to_string()).await;
}
}
// let user = repo::user::get(&pool, &usr.username).await.unwrap();
}
}