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>
pull/28887/head
kay delaney 5 years ago committed by GitHub
parent 27ea268f80
commit b2dcf06b60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      pkg/api/api.go
  2. 2
      pkg/api/http_server.go
  3. 5
      pkg/api/user.go

@ -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)

Loading…
Cancel
Save