h-ui
h-ui copied to clipboard
Telegram login hardening: 2FA lockout, DNS override, JWT warning, timeouts
Summary
- Login: on Telegram reminder failure return 503 with
code=tg_unavailablewhen 2FA is enabled; otherwise setjwt.telegram_warning=true. Add warnings via logrus. (controller/account.go, model/vo/jwt.go) - Telegram service: validate configs with detailed logs; use HTTP client with timeouts; optional DNS override via
TELEGRAM_DNS_SERVERS; add time-boundedGetMe/SendWithMessage; return wrapped errors; expose function vars for tests. (service/telegram.go) - Config: add
TELEGRAM_DNS_SERVERS,TELEGRAM_2FA_ENABLE. (model/constant/config.go) - DAO: guard nil sqlite handle in
GetConfig. (dao/config.go) - Tests: add
TestLoginTelegramFailureto asserttelegram_warning. (controller/login_test.go) - Build: bump to Go 1.21 and update x/crypto, x/net, x/sys. (go.mod/go.sum)
- Docs: README notes on internal DNS behavior.