Snapshots: Fix usage of sign in link from the snapshot page (#31986) (#32036)

Fix redirect to login page from snapshot page when not authenticated.

Fixes #28547

(cherry picked from commit a97637a133)

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2021-03-16 17:15:08 +01:00
committed by GitHub
co-authored by Marcus Efraimsson
parent cfc0e132f5
commit f570fb2d6f
2 changed files with 26 additions and 7 deletions
+2 -1
View File
@@ -18,6 +18,7 @@ var plog = log.New("api")
// registerRoutes registers all API HTTP routes.
func (hs *HTTPServer) registerRoutes() {
reqNoAuth := middleware.NoAuth()
reqSignedIn := middleware.ReqSignedIn
reqSignedInNoAnonymous := middleware.ReqSignedInNoAnonymous
reqGrafanaAdmin := middleware.ReqGrafanaAdmin
@@ -118,7 +119,7 @@ func (hs *HTTPServer) registerRoutes() {
r.Post("/api/user/password/reset", bind(dtos.ResetUserPasswordForm{}), routing.Wrap(ResetPassword))
// dashboard snapshots
r.Get("/dashboard/snapshot/*", hs.Index)
r.Get("/dashboard/snapshot/*", reqNoAuth, hs.Index)
r.Get("/dashboard/snapshots/", reqSignedIn, hs.Index)
// api renew session based on cookie