fix links

This commit is contained in:
Dietrich 2021-02-05 17:00:47 +01:00
parent d64f205162
commit 5d354800b5
Signed by: dietrich
GPG Key ID: 9F3C20C0F85DF67C

View File

@ -49,8 +49,8 @@ pub(crate) async fn index(
Ok(HttpResponse::Ok().body(rendered)) Ok(HttpResponse::Ok().body(rendered))
} else { } else {
Ok(HttpResponse::TemporaryRedirect() Ok(HttpResponse::TemporaryRedirect()
.set_header(actix_web::http::header::LOCATION, "/login/") .set_header(actix_web::http::header::LOCATION, "/admin/login/")
.body("Redirect to /login/")) .body("Redirect to /admin/login/"))
} }
} }
@ -84,8 +84,8 @@ pub(crate) async fn view_link(
Ok(HttpResponse::Ok().body(rendered)) Ok(HttpResponse::Ok().body(rendered))
} else { } else {
Ok(HttpResponse::TemporaryRedirect() Ok(HttpResponse::TemporaryRedirect()
.set_header(actix_web::http::header::LOCATION, "/login/") .set_header(actix_web::http::header::LOCATION, "/admin/login/")
.body("Redirect to /login/")) .body("Redirect to /admin/login/"))
} }
} }
@ -102,8 +102,8 @@ pub(crate) async fn signup(
Ok(HttpResponse::Ok().body(rendered)) Ok(HttpResponse::Ok().body(rendered))
} else { } else {
Ok(HttpResponse::TemporaryRedirect() Ok(HttpResponse::TemporaryRedirect()
.set_header(actix_web::http::header::LOCATION, "/login/") .set_header(actix_web::http::header::LOCATION, "/admin/login/")
.body("Redirect to /login/")) .body("Redirect to /admin/login/"))
} }
} }
@ -129,8 +129,8 @@ pub(crate) async fn process_signup(
Ok(HttpResponse::Ok().body(format!("Successfully saved user: {}", data.username))) Ok(HttpResponse::Ok().body(format!("Successfully saved user: {}", data.username)))
} else { } else {
Ok(HttpResponse::TemporaryRedirect() Ok(HttpResponse::TemporaryRedirect()
.set_header(actix_web::http::header::LOCATION, "/login/") .set_header(actix_web::http::header::LOCATION, "/admin/login/")
.body("Redirect to /login/")) .body("Redirect to /admin/login/"))
} }
} }
@ -143,8 +143,8 @@ pub(crate) async fn login(
if let Some(_id) = id.identity() { if let Some(_id) = id.identity() {
return Ok(HttpResponse::TemporaryRedirect() return Ok(HttpResponse::TemporaryRedirect()
.set_header(actix_web::http::header::LOCATION, "/index/") .set_header(actix_web::http::header::LOCATION, "/admin/index/")
.body("Redirect to /index/")); .body("Redirect to /admin/index/"));
} }
let rendered = tera.render("login.html", &data)?; let rendered = tera.render("login.html", &data)?;
@ -178,25 +178,25 @@ pub(crate) async fn process_login(
id.remember(session_token); id.remember(session_token);
Ok(HttpResponse::TemporaryRedirect() Ok(HttpResponse::TemporaryRedirect()
.set_header(actix_web::http::header::LOCATION, "/index/") .set_header(actix_web::http::header::LOCATION, "/admin/index/")
.body("Redirect to /index/")) .body("Redirect to /admin/index/"))
} else { } else {
Ok(HttpResponse::TemporaryRedirect() Ok(HttpResponse::TemporaryRedirect()
.set_header(actix_web::http::header::LOCATION, "/login/") .set_header(actix_web::http::header::LOCATION, "/admin/login/")
.body("Redirect to /login/")) .body("Redirect to /admin/login/"))
} }
} }
Err(_e) => Ok(HttpResponse::TemporaryRedirect() Err(_e) => Ok(HttpResponse::TemporaryRedirect()
.set_header(actix_web::http::header::LOCATION, "/login/") .set_header(actix_web::http::header::LOCATION, "/admin/login/")
.body("Redirect to /login/")), .body("Redirect to /admin/login/")),
} }
} }
pub(crate) async fn logout(id: Identity) -> Result<HttpResponse, ServerError> { pub(crate) async fn logout(id: Identity) -> Result<HttpResponse, ServerError> {
id.forget(); id.forget();
Ok(HttpResponse::TemporaryRedirect() Ok(HttpResponse::TemporaryRedirect()
.set_header(actix_web::http::header::LOCATION, "/login/") .set_header(actix_web::http::header::LOCATION, "/admin/login/")
.body("Redirect to /login/")) .body("Redirect to /admin/login/"))
} }
pub(crate) async fn redirect( pub(crate) async fn redirect(
@ -241,8 +241,8 @@ pub(crate) async fn submission(
return Ok(HttpResponse::Ok().body(rendered)); return Ok(HttpResponse::Ok().body(rendered));
} }
Ok(HttpResponse::TemporaryRedirect() Ok(HttpResponse::TemporaryRedirect()
.set_header(actix_web::http::header::LOCATION, "/login/") .set_header(actix_web::http::header::LOCATION, "/admin/login/")
.body("Redirect to /login/")) .body("Redirect to /admin/login/"))
} }
pub(crate) async fn process_submission( pub(crate) async fn process_submission(
@ -266,16 +266,16 @@ pub(crate) async fn process_submission(
.execute(&connection)?; .execute(&connection)?;
return Ok(HttpResponse::TemporaryRedirect() return Ok(HttpResponse::TemporaryRedirect()
.set_header(actix_web::http::header::LOCATION, "/index/") .set_header(actix_web::http::header::LOCATION, "/admin/index/")
.body("Redirect to /index/")); .body("Redirect to /admin/index/"));
} }
Err(_e) => Ok(HttpResponse::TemporaryRedirect() Err(_e) => Ok(HttpResponse::TemporaryRedirect()
.set_header(actix_web::http::header::LOCATION, "/login/") .set_header(actix_web::http::header::LOCATION, "/admin/login/")
.body("Redirect to /login/")), .body("Redirect to /admin/login/")),
} }
} else { } else {
Ok(HttpResponse::TemporaryRedirect() Ok(HttpResponse::TemporaryRedirect()
.set_header(actix_web::http::header::LOCATION, "/login/") .set_header(actix_web::http::header::LOCATION, "/admin/login/")
.body("Redirect to /login/")) .body("Redirect to /admin/login/"))
} }
} }