Explorar o código

[Fix] Changing email account password would fail when similar account names are found

Robert Zollner %!s(int64=5) %!d(string=hai) anos
pai
achega
ca4c8b5c04
Modificáronse 1 ficheiros con 4 adicións e 3 borrados
  1. 4 3
      bin/v-change-mail-account-password

+ 4 - 3
bin/v-change-mail-account-password

@@ -55,9 +55,10 @@ salt=$(generate_password "$PW_MATRIX" "8")
 md5="{MD5}$($BIN/v-generate-password-hash md5 $salt <<<$password)"
 
 if [[ "$MAIL_SYSTEM" =~ exim ]]; then
-    quota=$(grep $account $HESTIA/data/users/${user}/mail/${domain}.conf)
-    quota=$(echo $quota | awk '{ print $7 }' | sed -e "s/'//g" )
-    quota=$(echo $quota | cut -d "=" -f 2 | sed -e "s/unlimited/0/g")
+    quota=$(get_object_value "mail/$domain" 'ACCOUNT' "$account" '$QUOTA')
+    if [ "$quota" = 'unlimited' ]; then
+        quota=0
+    fi
     sed -i "/^$account:/d" $HOMEDIR/$user/conf/mail/$domain/passwd
     str="$account:$md5:$user:mail::$HOMEDIR/$user::userdb_quota_rule=*:storage=${quota}M"
     echo $str >> $HOMEDIR/$user/conf/mail/$domain/passwd