redirect to /login and redirect back, instead of showing small msg

This commit is contained in:
2026-04-09 15:20:02 +02:00
parent 3c111212f0
commit b93cdfba63
10 changed files with 217 additions and 211 deletions

View File

@@ -27,14 +27,17 @@ const LINE_ADD_RM_SCRIPT: &str = include_str!("line-add-rm.js");
const PREFILL_TIME_SCRIPT: &str = include_str!("prefill-time.js");
pub async fn page(req: Request) -> Result<Response, CompositeError> {
let u = User::authenticate(req.headers())?;
let u = match User::authenticate(req.headers())? {
Some(u) => u,
None => return Ok(Redirect::to(&format!("/login?r={}", req.uri().path())).into_response()),
};
let conn = database::conn()?;
let names = Name::get_all(&conn)?;
Ok(base(
"Add Quote | Mnemosyne",
html!(
(nav(u.as_ref(), req.uri().path()))
(nav(Some(&u), req.uri().path()))
div class="max-w-4xl mx-auto px-2" {
div class="my-4 flex justify-between" {