mirror of
https://github.com/minoplhy/chhoto-url.git
synced 2024-12-22 19:57:57 +00:00
chg: More readable response when not logged in
This commit is contained in:
parent
917be6ade4
commit
604e95aa9c
@ -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!")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user