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:
@@ -307,10 +307,10 @@ func NewKey() (string, error) {
|
||||
// server and multi-tenant editions are planned (PLAN.md, Phases 9–14) and
|
||||
// come in steps; until they're built, only the settings are checked.
|
||||
func (c *Config) Ready() error {
|
||||
if c.Edition == Local {
|
||||
if c.Edition != Multi {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("This version of Supermarket runs only the local edition: the %s edition isn't built yet. Its settings are fine", c.Edition.Name())
|
||||
return fmt.Errorf("This version of Supermarket runs the local and server editions: the %s edition isn't built yet. Its settings are fine", c.Edition.Name())
|
||||
}
|
||||
|
||||
// Item is one line of the settings, to show.
|
||||
|
||||
@@ -83,7 +83,7 @@ func TestServer(t *testing.T) {
|
||||
if m.Host != "mail.example.com:587" || m.TLS || m.User != "sm@example.com" || m.Password != "pw" || m.From != "Supermarket <no-reply@sm.example.com>" {
|
||||
t.Fatalf("%+v", m)
|
||||
}
|
||||
if err := c.Ready(); err == nil || !strings.Contains(err.Error(), "isn't built yet") {
|
||||
if err := c.Ready(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// The summary never shows a password.
|
||||
@@ -121,6 +121,9 @@ func TestMulti(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := c.Ready(); err == nil || !strings.Contains(err.Error(), "isn't built yet") {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s := c.Storage
|
||||
if s.Bucket != "supermarket" || s.Prefix != "prod" || s.Endpoint != "https://s3.example.com" || s.Region != "garage" || s.String() != "s3://supermarket/prod at https://s3.example.com" {
|
||||
t.Fatalf("%+v", s)
|
||||
|
||||
Reference in New Issue
Block a user