1
0
Fork 0
mirror of https://github.com/SinTan1729/chhoto-url synced 2024-12-26 07:38:36 -06:00

chg: More readable response when not logged in

This commit is contained in:
Sayantan Santra 2024-04-01 00:58:18 -05:00
parent 917be6ade4
commit 604e95aa9c
Signed by: SinTan1729
GPG key ID: EB3E68BFBA25C85F
2 changed files with 6 additions and 6 deletions

View file

@ -35,7 +35,7 @@ async fn add_link(req: String, data: web::Data<AppState>, 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<AppState>, 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!")
}
}

View file

@ -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();