must return json response from /api/login/ping

Even though http error 401 was returned, the result was still a http 200
This commit is contained in:
Marcus Efraimsson 2019-02-01 01:21:23 +01:00
parent 11c4967bdc
commit dd5a8275f1
No known key found for this signature in database
GPG Key ID: EBFE0FB04612DD4A

View File

@ -78,12 +78,13 @@ func tryOAuthAutoLogin(c *m.ReqContext) bool {
return false
}
func (hs *HTTPServer) LoginAPIPing(c *m.ReqContext) Response {
if c.IsSignedIn || c.IsAnonymous {
return JSON(200, "Logged in")
func (hs *HTTPServer) LoginAPIPing(c *m.ReqContext) {
if c.IsSignedIn || (c.AllowAnonymous && c.IsAnonymous) {
c.JsonOK("Logged in")
return
}
return Error(401, "Unauthorized", nil)
c.JsonApiErr(401, "Unauthorized", nil)
}
func (hs *HTTPServer) LoginPost(c *m.ReqContext, cmd dtos.LoginCommand) Response {