Bug fix
All checks were successful
Rust Build / Check (pull_request) Successful in 42s
Rust Build / Test Suite (pull_request) Successful in 1m1s
Rust Build / Rustfmt (pull_request) Successful in 31s
Rust Build / Clippy (pull_request) Successful in 45s
Rust Build / build (pull_request) Successful in 1m12s

This commit is contained in:
2025-04-07 13:46:23 -04:00
parent 905a06111c
commit 6b7fa86f59

View File

@@ -45,20 +45,14 @@ pub mod endpoint {
// Check if user exists
match repo::user::get(&pool, &payload.username).await {
Ok(user) => {
let salt = repo::salt::get(&pool, &user.salt_id).await.unwrap();
let salt_str = hashing::get_salt(&salt.salt).unwrap();
// let salt = repo::salt::get(&pool, &user.salt_id).await.unwrap();
// let salt_str = hashing::get_salt(&salt.salt).unwrap();
let unhashed_password = payload.password;
// Check if password is correct
match hashing::hash_password(&unhashed_password, &salt_str) {
Ok(hash_password) => {
if hashing::verify_password(&unhashed_password, hash_password.clone())
.unwrap()
{
if hashing::verify_password(&unhashed_password, user.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) {
(
@@ -80,11 +74,17 @@ pub mod endpoint {
} else {
return not_found("Error Hashing").await;
}
// Check if password is correct
/*
match hashing::hash_password(&unhashed_password, &salt_str) {
Ok(hash_password) => {
}
Err(err) => {
return not_found(&err.to_string()).await;
}
}
*/
}
Err(err) => {
return not_found(&err.to_string()).await;