main
tag: launch-2026-06-01
tag: magicmirror-v0.1.1
tag: magicmirror-v0.3.0
tag: mnw-cli-v0.1.2
tag: mnw-cli-v0.1.3
tag: mnw-cli-v0.1.4
tag: pom-v0.4.1
tag: pom-v0.4.2
tag: pom-v0.4.3
tag: pom-v0.4.4
tag: pom-v0.4.5
tag: wam-v0.3.0
tag: wam-v0.3.1
Files
Commits
Tags
Notes
Issues
Offer login and signup on the 401 error page
Anonymous GET /feed rendered a 401 whose only action was Go Home, so the
page never pointed at the thing that resolves it. Add Log in and Sign up
beside it, gated on the 401 status so every other error keeps the single
action.
Co-Authored-By
Claude Opus 5 (1M context) <noreply@anthropic.com>
2 files changed,
+42 insertions,
-0 deletions
8
8
<p class="error-status">{{ status_code }} ยท {{ status_text }}</p>
9
9
<h1 class="error-page-message">{{ message }}</h1>
10
10
<div class="error-actions">
11
+
{% if status_code == 401 %}
12
+
<a href="/login" class="btn-primary">Log in</a>
13
+
<a href="/join" class="btn-secondary">Sign up</a>
14
+
<a href="/" class="btn-secondary">Go Home</a>
15
+
{% else %}
11
16
<a href="/" class="btn-primary">Go Home</a>
17
+
{% endif %}
12
18
</div>
13
19
<p class="error-contact">
14
20
If this looks wrong, email <a href="mailto:info@makenot.work">info@makenot.work</a>.
731
731
resp.text
732
732
);
733
733
}
734
+
735
+
/// A 401 page offers the actions that resolve it, not only "Go Home".
736
+
///
737
+
/// Anonymous GET /feed was a dead end: the one thing that fixes a 401 is
738
+
/// logging in, and the error page linked nowhere near it.
739
+
#[tokio::test]
740
+
async fn unauthorized_page_offers_login_and_signup() {
741
+
let mut h = TestHarness::new().await;
742
+
743
+
let resp = h.client.get("/feed").await;
744
+
assert_eq!(resp.status, 401, "anonymous /feed should be 401");
745
+
assert!(
746
+
resp.text.contains("href=\"/login\""),
747
+
"401 page should link to login, got: {}",
748
+
resp.text
749
+
);
750
+
assert!(
751
+
resp.text.contains("href=\"/join\""),
752
+
"401 page should link to signup, got: {}",
753
+
resp.text
754
+
);
755
+
assert!(
756
+
resp.text.contains("Go Home"),
757
+
"401 page should keep Go Home, got: {}",
758
+
resp.text
759
+
);
760
+
761
+
// The auth actions are gated on the status: a 404 keeps the single action.
762
+
let resp = h.client.get("/definitely-not-a-page").await;
763
+
assert_eq!(resp.status, 404);
764
+
assert!(
765
+
!resp.text.contains("Sign up"),
766
+
"404 page should not offer the auth actions, got: {}",
767
+
resp.text
768
+
);
769
+
}