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:
parent
917be6ade4
commit
604e95aa9c
2 changed files with 6 additions and 6 deletions
|
@ -35,7 +35,7 @@ async fn add_link(req: String, data: web::Data<AppState>, session: Session) -> H
|
||||||
HttpResponse::BadRequest().body(out.1)
|
HttpResponse::BadRequest().body(out.1)
|
||||||
}
|
}
|
||||||
} else {
|
} 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) {
|
if auth::validate(session) {
|
||||||
HttpResponse::Ok().body(utils::getall(&data.db))
|
HttpResponse::Ok().body(utils::getall(&data.db))
|
||||||
} else {
|
} 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"));
|
let site_url = env::var("site_url").unwrap_or(String::from("unset"));
|
||||||
HttpResponse::Ok().body(site_url)
|
HttpResponse::Ok().body(site_url)
|
||||||
} else {
|
} 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!")
|
HttpResponse::NotFound().body("Not found!")
|
||||||
}
|
}
|
||||||
} else {
|
} 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 () => {
|
const refreshData = async () => {
|
||||||
let reply = await fetch(prepSubdir("/api/all")).then(res => res.text());
|
let reply = await fetch(prepSubdir("/api/all")).then(res => res.text());
|
||||||
if (reply == "logged_out") {
|
if (reply == "Not logged in!") {
|
||||||
console.log("logged_out");
|
console.log("Not logged in!");
|
||||||
document.getElementById("container").style.filter = "blur(2px)"
|
document.getElementById("container").style.filter = "blur(2px)"
|
||||||
document.getElementById("login-dialog").showModal();
|
document.getElementById("login-dialog").showModal();
|
||||||
document.getElementById("password").focus();
|
document.getElementById("password").focus();
|
||||||
|
|
Loading…
Reference in a new issue