From c2c9db737b7b504094b613bedae1604d4f505ccc Mon Sep 17 00:00:00 2001 From: Ilya Mateyko Date: Fri, 8 Oct 2021 15:13:37 +0300 Subject: [PATCH] Hide the logout link when using auth proxy Fixes #1250 --- template/functions.go | 3 +++ template/templates/common/layout.html | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/template/functions.go b/template/functions.go index c32e8b3e..4b21111d 100644 --- a/template/functions.go +++ b/template/functions.go @@ -45,6 +45,9 @@ func (f *funcMap) Map() template.FuncMap { "hasOAuth2Provider": func(provider string) bool { return config.Opts.OAuth2Provider() == provider }, + "hasAuthProxy": func() bool { + return config.Opts.AuthProxyHeader() != "" + }, "route": func(name string, args ...interface{}) string { return route.Path(f.router, name, args...) }, diff --git a/template/templates/common/layout.html b/template/templates/common/layout.html index b5750386..3eceb4dc 100644 --- a/template/templates/common/layout.html +++ b/template/templates/common/layout.html @@ -82,9 +82,11 @@
  • {{ t "menu.settings" }}
  • -
  • - {{ t "menu.logout" }} -
  • + {{ if not hasAuthProxy }} +
  • + {{ t "menu.logout" }} +
  • + {{ end }}