Ensure that the account contains a @ (#923, #924)

* 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:
Pierre-Yves Rofes 2018-04-04 18:59:28 +02:00 committed by Johan Smits
parent 7015d09404
commit 137d623171
3 changed files with 7 additions and 1 deletions

View file

@ -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"