Skip to content

Commit ca4c8b5

Browse files
committed
[Fix] Changing email account password would fail when similar account names are found
1 parent bfd7b48 commit ca4c8b5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

bin/v-change-mail-account-password

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ salt=$(generate_password "$PW_MATRIX" "8")
5555
md5="{MD5}$($BIN/v-generate-password-hash md5 $salt <<<$password)"
5656

5757
if [[ "$MAIL_SYSTEM" =~ exim ]]; then
58-
quota=$(grep $account $HESTIA/data/users/${user}/mail/${domain}.conf)
59-
quota=$(echo $quota | awk '{ print $7 }' | sed -e "s/'//g" )
60-
quota=$(echo $quota | cut -d "=" -f 2 | sed -e "s/unlimited/0/g")
58+
quota=$(get_object_value "mail/$domain" 'ACCOUNT' "$account" '$QUOTA')
59+
if [ "$quota" = 'unlimited' ]; then
60+
quota=0
61+
fi
6162
sed -i "/^$account:/d" $HOMEDIR/$user/conf/mail/$domain/passwd
6263
str="$account:$md5:$user:mail::$HOMEDIR/$user::userdb_quota_rule=*:storage=${quota}M"
6364
echo $str >> $HOMEDIR/$user/conf/mail/$domain/passwd

0 commit comments

Comments
 (0)