mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-04 18:15:29 +02:00
Testfixes & more (#942)
* fixed useless updatetest, made updatemailuser and addmailuser setup.sh compliant. * changed documentation
This commit is contained in:
parent
a564cca0e5
commit
59ce9d03f0
4 changed files with 19 additions and 14 deletions
|
@ -3,7 +3,8 @@
|
|||
DATABASE=${DATABASE:-/tmp/docker-mailserver/postfix-accounts.cf}
|
||||
|
||||
USER="$1"
|
||||
PASSWD="$(doveadm pw -s SHA512-CRYPT -u "$USER" -p "$2")"
|
||||
shift
|
||||
PASSWD="$@"
|
||||
|
||||
usage() {
|
||||
echo "Usage: updatemailuser <user@domain.tld> [password]"
|
||||
|
@ -20,6 +21,13 @@ escape() {
|
|||
|
||||
[ -z "$USER" ] && { usage; errex "no username specified"; }
|
||||
|
||||
if [ -z "$PASSWD" ]; then
|
||||
read -s -p "Enter Password: " PASSWD
|
||||
echo
|
||||
[ -z "$PASSWD" ] && errex "Password must not be empty"
|
||||
fi
|
||||
HASH="$(doveadm pw -s SHA512-CRYPT -u "$USER" -p "$PASSWD")"
|
||||
grep -qi "^$(escape "$USER")|" $DATABASE 2>/dev/null ||
|
||||
errex "User \"$USER\" does not exist"
|
||||
sed -i "s ^"$USER"|.* "$USER"|"$PASSWD" " $DATABASE
|
||||
|
||||
sed -i "s ^"$USER"|.* "$USER"|"$HASH" " $DATABASE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue