fix: Include query parameters in link back to login on register page

This commit is contained in:
Ginger
2026-05-08 13:50:59 -04:00
parent 1852732d9f
commit f5a38dd787
5 changed files with 61 additions and 5 deletions
+12 -3
View File
@@ -7,8 +7,9 @@
pub(crate) fn build() -> Router<crate::State> {
Router::new()
.route("/", get(index))
.route(&format!("{}/", crate::ROUTE_PREFIX), get(index))
.route("/", get(get_index))
.route(&format!("{}/", crate::ROUTE_PREFIX), get(get_index))
.route(&format!("{}/_book", crate::ROUTE_PREFIX), get(get_book))
}
template! {
@@ -18,7 +19,7 @@ struct Index<'a> use "index.html.j2" {
}
}
async fn index(
async fn get_index(
State(services): State<crate::State>,
Extension(context): Extension<TemplateContext>,
) -> Result {
@@ -28,3 +29,11 @@ async fn index(
services.firstrun.is_first_run(),
))
}
template! {
struct Book use "book.html.j2" {}
}
async fn get_book(Extension(context): Extension<TemplateContext>) -> Result {
response!(Book::new(context))
}
+2 -1
View File
@@ -76,8 +76,9 @@ struct $name:ident $(<$lifetime:lifetime>)? use $path:literal {
) => {
#[derive(Debug, askama::Template)]
#[template(path = $path)]
#[allow(unused)]
struct $name$(<$lifetime>)? {
context: $crate::pages::TemplateContext,
context: $crate::pages::TemplateContext,
$($field_name: $field_type,)*
}
+22
View File
@@ -0,0 +1,22 @@
html {
height: 100svh;
--bg: oklch(0.44 0.177 353.06);
background-color: var(--bg);
background-image: linear-gradient(180deg, var(--bg) 55%, black 100%);;
}
main {
margin-top: 20vh;
margin-left: 5%;
margin-right: 5%;
color: white;
font-family: monospace;
font-size: 1.3em;
line-height: 1.2;
}
em {
font-size: 1.35em;
font-weight: bold;
white-space: nowrap;
}
+23
View File
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>The Book of Matrix, 4:15</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noindex" />
<link rel="icon" href="{{ crate::ROUTE_PREFIX }}/resources/logo.svg">
<link rel="stylesheet" href="{{ crate::ROUTE_PREFIX }}/resources/book.css">
</head>
<body>
<main>
And the <em>Conduit</em> was greatly diminished, and it Rusted slowly in the dark, and its builders
were scattered to the four corners of the Network, and all seemed to be lost for those
who would stand against the <em>Great Homogeneous Mind</em> of the Federation. But lo!
From its corpse there formed a <em>New Coalition</em>, a team to <em>Continue</em> the legacy of the Conduit,
and their works pushed back the <em>Synapses of the Great Mind</em>, and illuminated the darkest corners
of the <em>Specification</em>, for the betterment of the Network at large. ◈
</main>
</body>
</html>
+2 -1
View File
@@ -80,7 +80,8 @@ Sign up
</form>
{% if !is_first_run %}
<div class="centered-links">
<a href="{{ crate::ROUTE_PREFIX }}/account/login">I already have an account</a>
{% let query = next.as_ref().map(serde_urlencoded::to_string).transpose().unwrap().unwrap_or_default() %}
<a href="{{ crate::ROUTE_PREFIX }}/account/login?{{ query }}">I already have an account</a>
</div>
{% endif %}
{% when RegisterBody::DetailsPrompt { username, require_email, flow, terms, validation_errors } %}