Phase 10, part 3: signing in and out, resets, locks and two-factor
The server edition now starts. Sign-in by email and password, limited per address and per IP; ten failures in a row lock the account and email its owner, and a reset by email (or an admin) unlocks it. Settings → Your account has the profile, the password, where you're signed in, and two-factor sign-in with an authenticator app (TOTP, from a QR code) and ten recovery codes. The app's own mail goes through SUPERMARKET_MAIL_URL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -84,8 +84,8 @@ func publicPath(p string) bool {
|
||||
switch {
|
||||
case p == "/healthz", p == "/favicon.ico", p == "/mcp",
|
||||
strings.HasPrefix(p, "/static/"),
|
||||
p == "/signin", p == "/signout",
|
||||
strings.HasPrefix(p, "/setup"):
|
||||
p == "/signin", p == "/signin/code", p == "/signout", p == "/forgot",
|
||||
strings.HasPrefix(p, "/reset/"), strings.HasPrefix(p, "/setup/"):
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -99,7 +99,7 @@ func (s *Server) sessions(next http.Handler) http.Handler {
|
||||
next.ServeHTTP(w, r.WithContext(context.WithValue(r.Context(), viewerKey, localOwner)))
|
||||
return
|
||||
}
|
||||
if !publicPath(r.URL.Path) || r.URL.Path == "/signin" {
|
||||
if !publicPath(r.URL.Path) || strings.HasPrefix(r.URL.Path, "/signin") {
|
||||
if done, err := s.hasOwner(); err != nil {
|
||||
s.serverError(w, err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user