oficina / memoria Public

A failed Keymail sign-in no longer loops back to Keymail

Standalone, Keymail's failure lands on /signin?force=1&err=keymail, but
the form carried force=1 back only with Home configured, so the next
submission was classified as Keymail again. The form now carries it in
both modes; beginGuard still refuses non-owners before any mail.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev d27355c7c57f6241b27384c62e2c7811cfd0ec97 parent 7198b5e
2 files changed, +16 −1
  • internal/memoria/chrome_test.go +15 −0
  • internal/memoria/handlers.go +1 −1

CI passed — run details

diff --git a/internal/memoria/chrome_test.go b/internal/memoria/chrome_test.go
index 69b8b0d..887829d 100644
--- a/internal/memoria/chrome_test.go
+++ b/internal/memoria/chrome_test.go
@@ -325,3 +325,18 @@ func TestConnectStartPageActionSaysConnect(t *testing.T) {
t.Error("the start action still says Continue")
}
}
+
+// Standalone, a failed Keymail sign-in lands on /signin?force=1&err=keymail.
+// The form must carry force=1 back, or the next submission classifies the
+// address as Keymail again and loops straight back to Keymail. Only Home
+// mode used to carry it.
+func TestStandaloneKeymailFallbackCarriesForce(t *testing.T) {
+ f := newLocalOnlyFixture(t)
+ w := f.do("GET", "/signin?force=1&err=keymail", "")
+ if w.Code != http.StatusOK {
+ t.Fatalf("GET = %d", w.Code)
+ }
+ if !regexp.MustCompile(`<input[^>]*name="force"[^>]*value="1"`).MatchString(w.Body.String()) {
+ t.Fatalf("the fallback form does not carry force=1:\n%s", w.Body.String())
+ }
+}
diff --git a/internal/memoria/handlers.go b/internal/memoria/handlers.go
index 45ca150..3f1eb80 100644
--- a/internal/memoria/handlers.go
+++ b/internal/memoria/handlers.go
@@ -1219,7 +1219,7 @@ func (a *app) localSignin(w http.ResponseWriter, r *http.Request) {
}
}
w.Header().Set("Cache-Control", "no-store")
- forceEmail := a.home != nil && q.Get("force") == "1"
+ forceEmail := q.Get("force") == "1"
msg, kind := signinOutcome(q)
icon, view := assets.Path("static/brand/icon.svg"), sky.For(r.Host)