diff --git a/internal/httpd/httpd.go b/internal/httpd/httpd.go index 957dbe96..0d437ea3 100644 --- a/internal/httpd/httpd.go +++ b/internal/httpd/httpd.go @@ -415,7 +415,7 @@ type UIBranding struct { ExtraCSS []string `json:"extra_css" mapstructure:"extra_css"` } -func (b *UIBranding) check(isWebClient bool) { +func (b *UIBranding) check() { if b.LogoPath != "" { b.LogoPath = util.CleanPath(b.LogoPath) } else { @@ -543,8 +543,8 @@ type Binding struct { } func (b *Binding) checkBranding() { - b.Branding.WebAdmin.check(false) - b.Branding.WebClient.check(true) + b.Branding.WebAdmin.check() + b.Branding.WebClient.check() if b.Branding.WebAdmin.Name == "" { b.Branding.WebAdmin.Name = "SFTPGo WebAdmin" } diff --git a/internal/httpd/server.go b/internal/httpd/server.go index 1912c60f..8ee0f509 100644 --- a/internal/httpd/server.go +++ b/internal/httpd/server.go @@ -578,7 +578,7 @@ func (s *httpdServer) handleWebAdminLoginPost(w http.ResponseWriter, r *http.Req } admin, err := dataprovider.CheckAdminAndPass(username, password, ipAddr) if err != nil { - handleDefenderEventLoginFailed(ipAddr, err) + handleDefenderEventLoginFailed(ipAddr, err) //nolint:errcheck s.renderAdminLoginPage(w, r, util.NewI18nError(dataprovider.ErrInvalidCredentials, util.I18nErrorInvalidCredentials), ipAddr) return diff --git a/templates/common/base.html b/templates/common/base.html index b515c172..9535e043 100644 --- a/templates/common/base.html +++ b/templates/common/base.html @@ -628,4 +628,357 @@ explicit grant from the SFTPGo Team (support@sftpgo.com). unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } +{{- end}} + +{{- define "theme-switcher"}} +
+ + + + + + + + + + + + + + + + + + + +
+{{- end}} + +{{- define "base"}} + + + + + + + + + {{- template "fonts" . }} + {{- range .Branding.DefaultCSS}} + + {{- end}} + {{- template "globalstyle" .CSPNonce }} + {{- block "extra_css" .}}{{- end}} + {{- range .Branding.ExtraCSS}} + + {{- end}} + {{- template "commonjs" .CSPNonce }} + + + + {{- template "theme-setup" .CSPNonce }} +
+ +
+
+
+ {{- if .LoggedUser.Username}} +
+
+
+
+ + + + +
+ + Logo + +
+
+
+
+ +
+ {{- template "navitems" .}} +
+
+
+
+ {{- end}} +
+ {{- if .LoggedUser.Username}} + +
+
+
+ +
+
+
+
+ +
+
+
+ {{- end}} +
+
+
+
+ {{- template "page_body" .}} +
+
+
+ {{- if .LoggedUser.Username}} + + {{- end}} +
+
+
+
+
+ + + + +
+
+ + +
+ + + +
+ +
+ + {{- block "modals" .}}{{- end}} + + + + + + + + + {{- template "basejs" . }} + + {{- block "extra_js" .}}{{- end}} + + {{- end}} \ No newline at end of file diff --git a/templates/webclient/base.html b/templates/webclient/base.html index 1c6b4a01..2a6d32a6 100644 --- a/templates/webclient/base.html +++ b/templates/webclient/base.html @@ -13,437 +13,96 @@ This WebUI is allowed for use only within the SFTPGo product and therefore cannot be used in derivative works/products without an explicit grant from the SFTPGo Team (support@sftpgo.com). --> -{{- define "base"}} - - - - - - - - - {{- template "fonts" . }} - {{- range .Branding.DefaultCSS}} - - {{- end}} - {{- template "globalstyle" .CSPNonce }} - {{- block "extra_css" .}}{{- end}} - {{- range .Branding.ExtraCSS}} - - {{- end}} - {{- template "commonjs" .CSPNonce }} - - - - {{- template "theme-setup" .CSPNonce }} -
- -
-
-
- {{- if .LoggedUser.Username}} -
-
-
-
- - - - -
- - Logo - -
-
-
-
- -
- {{- block "additionalnavitems" .}}{{- end}} - {{- if ne .CurrentURL .EditURL }} - - {{- end}} -
-
- - - - -
- -
-
-
-
+{{- define "navitems"}} +{{- block "additionalnavitems" .}}{{- end}} +{{- if ne .CurrentURL .EditURL }} +{{- template "theme-switcher"}} +{{- end}} +
+
+ + + + +
+