fix: schedule_account realm 改用 tenant.code,mail 連線改用 mailserver + starttls

- realm: 移除 tenant.keycloak_realm fallback,直接用 tenant.code (與 Keycloak realm 一致)
- IMAP: 10.1.0.254:143/none → mailserver:143/starttls
- SMTP: 10.1.0.254:587/none → mailserver:587/starttls

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
VMIS Developer
2026-03-16 07:11:35 +08:00
parent 60e85f565a
commit 47e24dbca9

View File

@@ -29,7 +29,7 @@ def run_account_check(schedule_log_id: int, db: Session):
for account in accounts:
tenant = account.tenant
realm = tenant.keycloak_realm or tenant.code
realm = tenant.code
result = AccountScheduleResult(
schedule_log_id=schedule_log_id,
account_id=account.id,
@@ -149,8 +149,8 @@ def run_account_check(schedule_log_id: int, db: Session):
f"docker exec -u www-data {nc_container} "
f"php /var/www/html/occ mail:account:create "
f"'{account.sso_account}' '{display}' '{email}' "
f"10.1.0.254 143 none '{email}' '{account.default_password}' "
f"10.1.0.254 587 none '{email}' '{account.default_password}' 2>&1"
f"mailserver 143 starttls '{email}' '{account.default_password}' "
f"mailserver 587 starttls '{email}' '{account.default_password}' 2>&1"
)
out_text = _ssh_run(create_cmd)
logger.info(f"NC mail:account:create [{account.sso_account}]: {out_text}")