From 604e95aa9c1b312bf2791e1ee27ab79f6a75b035 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Mon, 1 Apr 2024 00:58:18 -0500 Subject: [PATCH] chg: More readable response when not logged in --- actix/src/main.rs | 8 ++++---- resources/static/script.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/actix/src/main.rs b/actix/src/main.rs index 8d5901f..7620ca4 100644 --- a/actix/src/main.rs +++ b/actix/src/main.rs @@ -35,7 +35,7 @@ async fn add_link(req: String, data: web::Data, session: Session) -> H HttpResponse::BadRequest().body(out.1) } } else { - HttpResponse::Forbidden().body("logged_out") + HttpResponse::Forbidden().body("Not logged in!") } } @@ -45,7 +45,7 @@ async fn getall(data: web::Data, session: Session) -> HttpResponse { if auth::validate(session) { HttpResponse::Ok().body(utils::getall(&data.db)) } else { - HttpResponse::Forbidden().body("logged_out") + HttpResponse::Forbidden().body("Not logged in!") } } @@ -56,7 +56,7 @@ async fn siteurl(session: Session) -> HttpResponse { let site_url = env::var("site_url").unwrap_or(String::from("unset")); HttpResponse::Ok().body(site_url) } else { - HttpResponse::Forbidden().body("logged_out") + HttpResponse::Forbidden().body("Not logged in!") } } @@ -124,7 +124,7 @@ async fn delete_link( HttpResponse::NotFound().body("Not found!") } } else { - HttpResponse::Forbidden().body("Wrong password!") + HttpResponse::Forbidden().body("Not logged in!") } } diff --git a/resources/static/script.js b/resources/static/script.js index c9d6194..ac04832 100644 --- a/resources/static/script.js +++ b/resources/static/script.js @@ -25,8 +25,8 @@ const getVersion = async () => await fetch(prepSubdir("/api/version")) const refreshData = async () => { let reply = await fetch(prepSubdir("/api/all")).then(res => res.text()); - if (reply == "logged_out") { - console.log("logged_out"); + if (reply == "Not logged in!") { + console.log("Not logged in!"); document.getElementById("container").style.filter = "blur(2px)" document.getElementById("login-dialog").showModal(); document.getElementById("password").focus();