diff --git a/src/api/user.rs b/src/api/user.rs index 9a7d291..2dbf123 100644 --- a/src/api/user.rs +++ b/src/api/user.rs @@ -36,9 +36,13 @@ pub async fn login(request: HttpRequest, body: web::Json) -> impl Respond match authenticate(net_id, password) { Some(user) => { Identity::login(&request.extensions(), net_id.into()); - web::Json(user) + web::Json(user); + HttpResponse::Ok() }, - None => web::Json(User::default()) + None => { + web::Json(User::default()); + HttpResponse::Unauthorized() + } } } diff --git a/src/main.rs b/src/main.rs index be26b33..d97575f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize}; use actix_cors::Cors; use actix_identity::IdentityMiddleware; use actix_session::{SessionMiddleware, storage::CookieSessionStore}; + mod api; static PORT: u16 = 5000;