mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
now /api/login/ping returns Response
This commit is contained in:
@@ -108,8 +108,8 @@ func (hs *HTTPServer) registerRoutes() {
|
|||||||
r.Get("/api/snapshots-delete/:deleteKey", Wrap(DeleteDashboardSnapshotByDeleteKey))
|
r.Get("/api/snapshots-delete/:deleteKey", Wrap(DeleteDashboardSnapshotByDeleteKey))
|
||||||
r.Delete("/api/snapshots/:key", reqEditorRole, Wrap(DeleteDashboardSnapshot))
|
r.Delete("/api/snapshots/:key", reqEditorRole, Wrap(DeleteDashboardSnapshot))
|
||||||
|
|
||||||
// api renew session based on remember cookie
|
// api renew session based on cookie
|
||||||
r.Get("/api/login/ping", quota("session"), hs.LoginAPIPing)
|
r.Get("/api/login/ping", quota("session"), Wrap(hs.LoginAPIPing))
|
||||||
|
|
||||||
// authed api
|
// authed api
|
||||||
r.Group("/api", func(apiRoute routing.RouteRegister) {
|
r.Group("/api", func(apiRoute routing.RouteRegister) {
|
||||||
|
|||||||
@@ -78,13 +78,12 @@ func tryOAuthAutoLogin(c *m.ReqContext) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hs *HTTPServer) LoginAPIPing(c *m.ReqContext) {
|
func (hs *HTTPServer) LoginAPIPing(c *m.ReqContext) Response {
|
||||||
if c.IsSignedIn || (c.AllowAnonymous && c.IsAnonymous) {
|
if c.IsSignedIn || c.IsAnonymous {
|
||||||
c.JsonOK("Logged in")
|
return JSON(200, "Logged in")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c.JsonApiErr(401, "Unauthorized", nil)
|
return Error(401, "Unauthorized", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hs *HTTPServer) LoginPost(c *m.ReqContext, cmd dtos.LoginCommand) Response {
|
func (hs *HTTPServer) LoginPost(c *m.ReqContext, cmd dtos.LoginCommand) Response {
|
||||||
|
|||||||
Reference in New Issue
Block a user