Formatted files

This commit is contained in:
2025-03-17 15:01:19 +01:00
parent 1280c745c7
commit b9f02e9f6e
5 changed files with 70 additions and 34 deletions

View File

@@ -1,19 +1,19 @@
use std::fs::File;
use std::io::Read;
use crate::AppState;
use actix_web::cookie::Cookie;
use actix_web::web::{Data, Json};
use actix_web::{HttpRequest, HttpResponse, Responder, post};
use argon2::Argon2;
use actix_web::{post, HttpRequest, HttpResponse, Responder};
use argon2::password_hash::{
PasswordHash, PasswordHasher, PasswordVerifier, SaltString, rand_core::OsRng
rand_core::OsRng, PasswordHash, PasswordHasher, PasswordVerifier, SaltString,
};
use argon2::Argon2;
use jsonwebtoken::{
Algorithm, DecodingKey, EncodingKey, Header, Validation, decode, encode, get_current_timestamp,
decode, encode, get_current_timestamp, Algorithm, DecodingKey, EncodingKey, Header, Validation,
};
use rand::Rng;
use serde::{Deserialize, Serialize};
use sqlx::{query, query_as};
use std::fs::File;
use std::io::Read;
use uuid::Uuid;
#[derive(Serialize, Deserialize)]
@@ -121,13 +121,17 @@ async fn logout(req: HttpRequest, app_state: Data<AppState>) -> impl Responder {
.await
.is_err()
{
return HttpResponse::InternalServerError().reason("Query fail").finish();
return HttpResponse::InternalServerError()
.reason("Query fail")
.finish();
}
}
Err(e) => {
let message = format!("Error: {e}");
println!("{}", message);
return HttpResponse::InternalServerError().reason("Token caca").finish();
return HttpResponse::InternalServerError()
.reason("Token caca")
.finish();
}
}
let mut cookie = Cookie::new("token", "");