From 69899c0f795ebc518bcdd151e758dae973ad1cc0 Mon Sep 17 00:00:00 2001 From: bsbds <69835502+bsbds@users.noreply.github.com> Date: Sun, 29 May 2022 12:24:22 +0000 Subject: [PATCH] fix(login): ensure being in the dhcp table before login (#49) closes #48 --- pkg/handler/ipgw.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/handler/ipgw.go b/pkg/handler/ipgw.go index 0ce9cfd..9f3eac1 100644 --- a/pkg/handler/ipgw.go +++ b/pkg/handler/ipgw.go @@ -46,7 +46,16 @@ func (h *IpgwHandler) Login(account *model.Account) error { password string body string err error + resp *http.Response ) + + // 修复首次登录失败问题 + resp, err = h.client.Get("http://198.18.0.1") + if err != nil { + return err + } + defer resp.Body.Close() + if account.Cookie != "" { body, err = h.loginCookie(account.Cookie) // 通过cookie登录 } else {