mirror of
https://github.com/h44z/wg-portal.git
synced 2026-11-20 20:53:40 +01:00
feat(auth): require changing default admin password (#778)
This commit is contained in:
@@ -72,23 +72,23 @@ func (e UserEndpoint) RegisterRoutes(g *routegroup.Bundle) {
|
||||
apiGroup := g.Mount("/user")
|
||||
apiGroup.Use(e.authenticator.LoggedIn())
|
||||
|
||||
apiGroup.With(e.authenticator.LoggedIn(ScopeAdmin)).HandleFunc("GET /all", e.handleAllGet())
|
||||
apiGroup.With(e.authenticator.LoggedIn(ScopeAdmin), e.authenticator.RequireNonDefaultPassword()).HandleFunc("GET /all", e.handleAllGet())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id")).HandleFunc("GET /{id}", e.handleSingleGet())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id")).HandleFunc("PUT /{id}", e.handleUpdatePut())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id")).HandleFunc("DELETE /{id}", e.handleDelete())
|
||||
apiGroup.With(e.authenticator.LoggedIn(ScopeAdmin)).HandleFunc("POST /new", e.handleCreatePost())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id")).HandleFunc("GET /{id}/peers", e.handlePeersGet())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id")).HandleFunc("GET /{id}/stats", e.handleStatsGet())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id")).HandleFunc("GET /{id}/interfaces", e.handleInterfacesGet())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id")).HandleFunc("POST /{id}/api/enable", e.handleApiEnablePost())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id")).HandleFunc("POST /{id}/api/disable", e.handleApiDisablePost())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id"), e.authenticator.RequireNonDefaultPassword()).HandleFunc("PUT /{id}", e.handleUpdatePut())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id"), e.authenticator.RequireNonDefaultPassword()).HandleFunc("DELETE /{id}", e.handleDelete())
|
||||
apiGroup.With(e.authenticator.LoggedIn(ScopeAdmin), e.authenticator.RequireNonDefaultPassword()).HandleFunc("POST /new", e.handleCreatePost())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id"), e.authenticator.RequireNonDefaultPassword()).HandleFunc("GET /{id}/peers", e.handlePeersGet())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id"), e.authenticator.RequireNonDefaultPassword()).HandleFunc("GET /{id}/stats", e.handleStatsGet())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id"), e.authenticator.RequireNonDefaultPassword()).HandleFunc("GET /{id}/interfaces", e.handleInterfacesGet())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id"), e.authenticator.RequireNonDefaultPassword()).HandleFunc("POST /{id}/api/enable", e.handleApiEnablePost())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id"), e.authenticator.RequireNonDefaultPassword()).HandleFunc("POST /{id}/api/disable", e.handleApiDisablePost())
|
||||
apiGroup.With(e.authenticator.UserIdMatch("id")).HandleFunc("POST /{id}/change-password",
|
||||
e.handleChangePasswordPost())
|
||||
apiGroup.With(e.authenticator.LoggedIn(ScopeAdmin)).HandleFunc("POST /bulk-delete", e.handleBulkDelete())
|
||||
apiGroup.With(e.authenticator.LoggedIn(ScopeAdmin)).HandleFunc("POST /bulk-enable", e.handleBulkEnable())
|
||||
apiGroup.With(e.authenticator.LoggedIn(ScopeAdmin)).HandleFunc("POST /bulk-disable", e.handleBulkDisable())
|
||||
apiGroup.With(e.authenticator.LoggedIn(ScopeAdmin)).HandleFunc("POST /bulk-lock", e.handleBulkLock())
|
||||
apiGroup.With(e.authenticator.LoggedIn(ScopeAdmin)).HandleFunc("POST /bulk-unlock", e.handleBulkUnlock())
|
||||
apiGroup.With(e.authenticator.LoggedIn(ScopeAdmin), e.authenticator.RequireNonDefaultPassword()).HandleFunc("POST /bulk-delete", e.handleBulkDelete())
|
||||
apiGroup.With(e.authenticator.LoggedIn(ScopeAdmin), e.authenticator.RequireNonDefaultPassword()).HandleFunc("POST /bulk-enable", e.handleBulkEnable())
|
||||
apiGroup.With(e.authenticator.LoggedIn(ScopeAdmin), e.authenticator.RequireNonDefaultPassword()).HandleFunc("POST /bulk-disable", e.handleBulkDisable())
|
||||
apiGroup.With(e.authenticator.LoggedIn(ScopeAdmin), e.authenticator.RequireNonDefaultPassword()).HandleFunc("POST /bulk-lock", e.handleBulkLock())
|
||||
apiGroup.With(e.authenticator.LoggedIn(ScopeAdmin), e.authenticator.RequireNonDefaultPassword()).HandleFunc("POST /bulk-unlock", e.handleBulkUnlock())
|
||||
}
|
||||
|
||||
// handleAllGet returns a gorm Handler function.
|
||||
|
||||
Reference in New Issue
Block a user