Commit b2dcf06b by kay delaney Committed by GitHub

Backend: Adds route for well-known change password URL (#28788)

* Backend: Adds route for well-known change password URL

* Include 'dashboard/new' in backend routes

* Move index route handler registration out of "not logged in views" section

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
parent 27ea268f
......@@ -33,8 +33,10 @@ func (hs *HTTPServer) registerRoutes() {
r.Get("/invite/:code", hs.Index)
// authed views
r.Get("/", reqSignedIn, hs.Index)
r.Get("/profile/", reqSignedIn, hs.Index)
r.Get("/profile/password", reqSignedIn, hs.Index)
r.Get("/.well-known/change-password", redirectToChangePassword)
r.Get("/profile/switch-org/:id", reqSignedIn, hs.ChangeActiveOrgAndRedirectToHome)
r.Get("/org/", reqOrgAdmin, hs.Index)
r.Get("/org/new", reqGrafanaAdmin, hs.Index)
......@@ -71,6 +73,7 @@ func (hs *HTTPServer) registerRoutes() {
r.Get("/d/:uid", reqSignedIn, redirectFromLegacyPanelEditURL, hs.Index)
r.Get("/dashboard/db/:slug", reqSignedIn, redirectFromLegacyDashboardURL, hs.Index)
r.Get("/dashboard/script/*", reqSignedIn, hs.Index)
r.Get("/dashboard/new", reqSignedIn, hs.Index)
r.Get("/dashboard-solo/snapshot/*", hs.Index)
r.Get("/d-solo/:uid/:slug", reqSignedIn, hs.Index)
r.Get("/d-solo/:uid", reqSignedIn, hs.Index)
......@@ -442,6 +445,4 @@ func (hs *HTTPServer) registerRoutes() {
r.Get("/api/snapshots/:key", Wrap(GetDashboardSnapshot))
r.Get("/api/snapshots-delete/:deleteKey", reqSnapshotPublicModeOrSignedIn, Wrap(DeleteDashboardSnapshotByDeleteKey))
r.Delete("/api/snapshots/:key", reqEditorRole, Wrap(DeleteDashboardSnapshot))
r.Get("/*", reqSignedIn, hs.Index)
}
......@@ -288,7 +288,7 @@ func (hs *HTTPServer) applyRoutes() {
// then custom app proxy routes
hs.initAppPluginRoutes(hs.macaron)
// lastly not found route
hs.macaron.NotFound(hs.NotFoundHandler)
hs.macaron.NotFound(middleware.ReqSignedIn, hs.NotFoundHandler)
}
func (hs *HTTPServer) addMiddlewaresAndStaticRoutes() {
......
......@@ -250,6 +250,11 @@ func ChangeUserPassword(c *models.ReqContext, cmd models.ChangeUserPasswordComma
return Success("User password changed")
}
// redirectToChangePassword handles GET /.well-known/change-password.
func redirectToChangePassword(c *models.ReqContext) {
c.Redirect("/profile/password", 302)
}
// GET /api/users
func SearchUsers(c *models.ReqContext) Response {
query, err := searchUser(c)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment