mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
* Ensure that the provided username actually contains a domain * Update README.md to be consistent with addmailuser script * Add a test to check if the username includes the domain
This commit is contained in:
parent
7015d09404
commit
137d623171
|
@ -67,7 +67,7 @@ Download the docker-compose.yml, the .env and the setup.sh files:
|
|||
|
||||
#### Create your mail accounts
|
||||
|
||||
./setup.sh email add <email> [<password>]
|
||||
./setup.sh email add <user@domain> [<password>]
|
||||
|
||||
#### Generate DKIM keys
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ escape() {
|
|||
}
|
||||
|
||||
[ -z "$USER" ] && { usage; errex "no username specified"; }
|
||||
expr index "$USER" "@" >/dev/null || { usage; errex "username must include the domain"; }
|
||||
|
||||
grep -qi "^$(escape "$USER")|" $DATABASE 2>/dev/null &&
|
||||
errex "User \"$USER\" already exists"
|
||||
|
|
|
@ -1050,6 +1050,11 @@ load 'test_helper/bats-assert/load'
|
|||
#
|
||||
# accounts
|
||||
#
|
||||
@test "checking accounts: user_without_domain creation should be rejected since user@domain format is required" {
|
||||
run docker exec mail /bin/sh -c "addmailuser user_without_domain mypassword"
|
||||
assert_failure
|
||||
assert_output --partial "username must include the domain"
|
||||
}
|
||||
|
||||
@test "checking accounts: user3 should have been added to /tmp/docker-mailserver/postfix-accounts.cf" {
|
||||
docker exec mail /bin/sh -c "addmailuser user3@domain.tld mypassword"
|
||||
|
|
Loading…
Reference in a new issue