diff --git a/ctl.go b/ctl.go index 5cd5e62..76dee41 100644 --- a/ctl.go +++ b/ctl.go @@ -355,15 +355,15 @@ func servectlcmd(ctx context.Context, ctl *ctl, shutdown func()) { case "setaccountpassword": /* protocol: > "setaccountpassword" - > address + > account > password < "ok" or error */ - addr := ctl.xread() + account := ctl.xread() pw := ctl.xread() - acc, _, err := store.OpenEmail(addr) + acc, err := store.OpenAccount(account) ctl.xcheck(err, "open account") defer func() { if acc != nil { diff --git a/ctl_test.go b/ctl_test.go index c56c330..bb61d5d 100644 --- a/ctl_test.go +++ b/ctl_test.go @@ -61,7 +61,7 @@ func TestCtl(t *testing.T) { // "setaccountpassword" testctl(func(ctl *ctl) { - ctlcmdSetaccountpassword(ctl, "mjl@mox.example", "test4321") + ctlcmdSetaccountpassword(ctl, "mjl", "test4321") }) err := queue.Init() diff --git a/doc.go b/doc.go index 1157e86..40a7647 100644 --- a/doc.go +++ b/doc.go @@ -16,7 +16,7 @@ low-maintenance self-hosted email. mox serve mox quickstart [-existing-webserver] [-hostname host] user@domain [user | uid] mox stop - mox setaccountpassword address + mox setaccountpassword account mox setadminpassword mox loglevels [level [pkg]] mox queue list @@ -156,9 +156,11 @@ password itself, are stored in the account database. The stored secrets are for authentication with: scram-sha-256, scram-sha-1, cram-md5, plain text (bcrypt hash). -Any email address configured for the account can be used. +The parameter is an account name, as configured under Accounts in domains.conf +and as present in the data/accounts/ directory, not a configured email address +for an account. - usage: mox setaccountpassword address + usage: mox setaccountpassword account # mox setadminpassword diff --git a/docker-compose-imaptest.yml b/docker-compose-imaptest.yml index 38a7a30..88924e3 100644 --- a/docker-compose-imaptest.yml +++ b/docker-compose-imaptest.yml @@ -10,7 +10,7 @@ services: - ./testdata/imaptest/imaptest.mbox:/mox/imaptest.mbox working_dir: /mox tty: true # For job control with set -m. - command: sh -c 'set -m; mox serve & sleep 1; echo testtest | mox setaccountpassword mjl@mox.example; fg' + command: sh -c 'set -m; mox serve & sleep 1; echo testtest | mox setaccountpassword mjl; fg' healthcheck: test: netstat -nlt | grep ':1143 ' interval: 1s diff --git a/main.go b/main.go index 1c08cd5..0289f2b 100644 --- a/main.go +++ b/main.go @@ -681,7 +681,7 @@ func ctlcmdConfigAccountAdd(ctl *ctl, account, address string) { ctl.xwrite(account) ctl.xwrite(address) ctl.xreadok() - fmt.Printf("account added, set a password with \"mox setaccountpassword %s\"\n", address) + fmt.Printf("account added, set a password with \"mox setaccountpassword %s\"\n", account) } func cmdConfigAccountRemove(c *cmd) { @@ -1136,7 +1136,7 @@ pick a random, unguessable password, preferably at least 12 characters. } func cmdSetaccountpassword(c *cmd) { - c.params = "address" + c.params = "account" c.help = `Set new password an account. The password is read from stdin. Secrets derived from the password, but not the @@ -1144,7 +1144,9 @@ password itself, are stored in the account database. The stored secrets are for authentication with: scram-sha-256, scram-sha-1, cram-md5, plain text (bcrypt hash). -Any email address configured for the account can be used. +The parameter is an account name, as configured under Accounts in domains.conf +and as present in the data/accounts/ directory, not a configured email address +for an account. ` args := c.Parse() if len(args) != 1 { @@ -1157,9 +1159,9 @@ Any email address configured for the account can be used. ctlcmdSetaccountpassword(xctl(), args[0], pw) } -func ctlcmdSetaccountpassword(ctl *ctl, address, password string) { +func ctlcmdSetaccountpassword(ctl *ctl, account, password string) { ctl.xwrite("setaccountpassword") - ctl.xwrite(address) + ctl.xwrite(account) ctl.xwrite(password) ctl.xreadok() } diff --git a/testdata/integration/moxacmepebble.sh b/testdata/integration/moxacmepebble.sh index f6fb533..a51cfea 100755 --- a/testdata/integration/moxacmepebble.sh +++ b/testdata/integration/moxacmepebble.sh @@ -33,7 +33,7 @@ CURL_CA_BUNDLE=/integration/tls/ca.pem curl -o /integration/tmp-pebble-ca.pem ht mox -checkconsistency serve & while true; do if test -e data/ctl; then - echo -n accountpass1234 | mox setaccountpassword moxtest1@mox1.example + echo -n accountpass1234 | mox setaccountpassword moxtest1 break fi sleep 0.1 diff --git a/testdata/integration/moxmail2.sh b/testdata/integration/moxmail2.sh index a6a1c8c..06b6676 100755 --- a/testdata/integration/moxmail2.sh +++ b/testdata/integration/moxmail2.sh @@ -29,7 +29,7 @@ unbound-control -s 172.28.1.30 reload # reload unbound with zone file changes mox -checkconsistency serve & while true; do if test -e data/ctl; then - echo -n accountpass4321 | mox setaccountpassword moxtest2@mox2.example + echo -n accountpass4321 | mox setaccountpassword moxtest2 break fi sleep 0.1