The endpoint is working

This commit is contained in:
2026-06-11 17:06:22 -04:00
parent be6b933765
commit da7df3bb66
3 changed files with 24 additions and 5 deletions
+9 -1
View File
@@ -236,10 +236,12 @@ pub async fn service_user_login(
}),
)
} else {
println!("Good to create");
let service_user =
match repo::service::get_with_username(&pool, &payload.username).await {
Ok(service_user) => service_user,
Err(_err) => {
Err(err) => {
eprintln!("Error: {err:?}");
return (
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response::LoginResponse {
@@ -249,12 +251,16 @@ pub async fn service_user_login(
);
}
};
println!("Service user: {service_user:?}");
println!("Payload: {:?}", payload.passphrase);
let hashed_password = service_user.passphrase.clone();
println!("Hash password: {hashed_password:?}");
match hashing::verify_password(&payload.passphrase, hashed_password) {
Ok(matches) => {
if matches {
// Create token
println!("Creating token");
let key = textsender_models::envy::environment::get_secret_key()
.await
.value;
@@ -288,6 +294,7 @@ pub async fn service_user_login(
}),
)
} else {
eprintln!("Invalid token");
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response::LoginResponse {
@@ -297,6 +304,7 @@ pub async fn service_user_login(
)
}
} else {
eprintln!("No match");
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response::LoginResponse {