Tokens: User improvements

This commit is contained in:
Tom 2023-06-29 09:44:04 +02:00
parent 8ccd490bed
commit 4f4fa2b3d7
6 changed files with 117 additions and 24 deletions

View file

@ -41,18 +41,22 @@ func (g GrantWithURL) AdminURL() template.URL {
}
func (panel *UserPanel) routeUser(ctx context.Context) http.Handler {
actions := []component.MenuItem{
menuChangePassword,
menuTOTPAction,
menuSSH,
}
if panel.Config.HTTP.API.Value {
actions = append(actions, menuTokens)
}
tpl := userTemplate.Prepare(
panel.Dependencies.Templating,
templating.Crumbs(
menuUser,
),
templating.Actions(
menuChangePassword,
menuTOTPAction,
menuSSH,
menuTokens,
),
templating.Actions(actions...),
)
return tpl.HTMLHandlerWithFlags(func(r *http.Request) (uc userContext, funcs []templating.FlagFunc, err error) {