提交 a4eecdaa 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

ignore error caused by login request return a html

上级 eb65f29a
......@@ -2,7 +2,7 @@ Version = 1
Language = zh
Url = http://zentaopms.ngtesting.com/
Account = admin
Password = P2ssw0rd
Password = P2ssw0rd2
Javascript =
Lua =
Perl =
......
......@@ -197,17 +197,13 @@ func PostStr(url string, params map[string]string) (msg string, ok bool) {
var bodyJson model.ZentaoResponse
jsonErr := json.Unmarshal(bodyStr, &bodyJson)
isLogin := strings.Index(url, "login") > -1
if jsonErr != nil {
if isLogin && strings.Index(string(bodyStr), "location=") > -1 { // ignore login request return a html
ok = true
} else {
ok = false
if !isLogin && vari.Verbose {
if vari.Verbose {
if strings.Index(url, "login") == -1 { // jsonErr caused by login request return a html
logUtils.PrintToCmd(jsonErr.Error(), color.FgRed)
}
}
ok = false
return
}
......
......@@ -20,7 +20,7 @@ func Login(baseUrl string, account string, password string) bool {
// $referer = '', $from = ''
uri := ""
if vari.RequestType == constant.RequestTypePathInfo {
uri = "user-login"
uri = "user-login.json"
} else {
uri = "index.php?m=user&f=login&t=json"
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册