修改登录失败处理

This commit is contained in:
eatmoreapple 2022-11-27 23:08:31 +08:00
parent fe2f73b5a2
commit dd0d6603a7
2 changed files with 9 additions and 0 deletions

View File

@ -4,7 +4,9 @@ import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"os"
)
@ -86,6 +88,10 @@ func (c *Caller) GetLoginInfo(body []byte) (*LoginInfo, error) {
if err != nil {
return nil, err
}
// 判断是否重定向
if resp.StatusCode != http.StatusMovedPermanently {
return nil, fmt.Errorf("%w: try to login with Desktop Mode", ErrForbidden)
}
defer func() { _ = resp.Body.Close() }()
var loginInfo LoginInfo

View File

@ -18,3 +18,6 @@ func IgnoreNetworkError(errHandler func(err error)) func(error) {
}
}
}
// ErrForbidden 禁止当前账号登录
var ErrForbidden = errors.New("login forbidden")