diff --git a/pkg/api/login.go b/pkg/api/login.go index 50c62e0835a..3f2d82a6c0f 100644 --- a/pkg/api/login.go +++ b/pkg/api/login.go @@ -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 {