From c9bd08cf9ca286a23f9ba1b367a093da7045a4cc Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sun, 15 May 2022 07:30:36 +0200 Subject: [PATCH] UI branding: use the short name on the login pages Signed-off-by: Nicola Murino --- docs/full-configuration.md | 2 +- httpd/server.go | 2 ++ httpd/web.go | 1 + templates/webadmin/login.html | 4 ++-- templates/webclient/baselogin.html | 2 +- templates/webclient/login.html | 2 +- vfs/azblobfs.go | 2 +- vfs/gcsfs.go | 2 +- vfs/osfs.go | 2 +- vfs/s3fs.go | 2 +- vfs/sftpfs.go | 2 +- 11 files changed, 13 insertions(+), 10 deletions(-) diff --git a/docs/full-configuration.md b/docs/full-configuration.md index e0485bbf..991eff15 100644 --- a/docs/full-configuration.md +++ b/docs/full-configuration.md @@ -274,7 +274,7 @@ The configuration file contains the following sections: - `expect_ct_header`, string. Allows to set the `Expect-CT` header value. Default: blank. - `branding`, struct. Defines the supported customizations to suit your brand. It contains the `web_admin` and `web_client` structs that define customizations for the WebAdmin and the WebClient UIs. Each customization struct contains the following fields: - `name`, string. Defines the UI name - - `short_name`, string. Define the short name to show next to the logo image + - `short_name`, string. Defines the short name to show next to the logo image and on the login page - `favicon_path`, string. Path to the favicon relative to `static_files_path`. For example, if you create a directory named `branding` inside the static dir and put the `favicon.ico` file in it, you must set `/branding/favicon.ico` as path. - `logo_path`, string. Path to your logo relative to `static_files_path`. The preferred image size is 256x256 pixel - `login_image_path`, string. Path to a custom image to show on the login screen relative to `static_files_path`. The preferred image size is 900x900 pixel diff --git a/httpd/server.go b/httpd/server.go index ca410e51..035a9287 100644 --- a/httpd/server.go +++ b/httpd/server.go @@ -144,6 +144,7 @@ func (s *httpdServer) renderClientLoginPage(w http.ResponseWriter, error, ip str } if s.binding.showAdminLoginURL() { data.AltLoginURL = webAdminLoginPath + data.AltLoginName = s.binding.Branding.WebAdmin.ShortName } if smtp.IsEnabled() { data.ForgotPwdURL = webClientForgotPwdPath @@ -520,6 +521,7 @@ func (s *httpdServer) renderAdminLoginPage(w http.ResponseWriter, error, ip stri } if s.binding.showClientLoginURL() { data.AltLoginURL = webClientLoginPath + data.AltLoginName = s.binding.Branding.WebClient.ShortName } if smtp.IsEnabled() { data.ForgotPwdURL = webAdminForgotPwdPath diff --git a/httpd/web.go b/httpd/web.go index 6498592e..67785ddf 100644 --- a/httpd/web.go +++ b/httpd/web.go @@ -31,6 +31,7 @@ type loginPage struct { CSRFToken string StaticURL string AltLoginURL string + AltLoginName string ForgotPwdURL string OpenIDLoginURL string Branding UIBranding diff --git a/templates/webadmin/login.html b/templates/webadmin/login.html index 698df4cb..96bf2253 100644 --- a/templates/webadmin/login.html +++ b/templates/webadmin/login.html @@ -4,7 +4,7 @@ {{define "content"}}
-

{{.Branding.Name}} - {{.Version}}

+

{{.Branding.ShortName}} - {{.Version}}

{{if .Error}}
@@ -40,7 +40,7 @@ {{if .AltLoginURL}}
{{end}} {{if and .Branding.DisclaimerName .Branding.DisclaimerPath}} diff --git a/templates/webclient/baselogin.html b/templates/webclient/baselogin.html index 8fe5a09a..0614ce52 100644 --- a/templates/webclient/baselogin.html +++ b/templates/webclient/baselogin.html @@ -48,7 +48,7 @@
-

{{.Branding.Name}} - {{.Version}}

+

{{.Branding.ShortName}} - {{.Version}}

{{template "content" .}}
diff --git a/templates/webclient/login.html b/templates/webclient/login.html index b8403bdc..78bff865 100644 --- a/templates/webclient/login.html +++ b/templates/webclient/login.html @@ -37,7 +37,7 @@ {{if .AltLoginURL}}
{{end}} {{if and .Branding.DisclaimerName .Branding.DisclaimerPath}} diff --git a/vfs/azblobfs.go b/vfs/azblobfs.go index 2cd55cbb..ebbdd120 100644 --- a/vfs/azblobfs.go +++ b/vfs/azblobfs.go @@ -766,7 +766,7 @@ func (*AzureBlobFs) Close() error { return nil } -// GetAvailableDiskSize return the available size for the specified path +// GetAvailableDiskSize returns the available size for the specified path func (*AzureBlobFs) GetAvailableDiskSize(dirName string) (*sftp.StatVFS, error) { return nil, ErrStorageSizeUnavailable } diff --git a/vfs/gcsfs.go b/vfs/gcsfs.go index 9ab17f64..05f3e61a 100644 --- a/vfs/gcsfs.go +++ b/vfs/gcsfs.go @@ -831,7 +831,7 @@ func (fs *GCSFs) Close() error { return nil } -// GetAvailableDiskSize return the available size for the specified path +// GetAvailableDiskSize returns the available size for the specified path func (*GCSFs) GetAvailableDiskSize(dirName string) (*sftp.StatVFS, error) { return nil, ErrStorageSizeUnavailable } diff --git a/vfs/osfs.go b/vfs/osfs.go index ea2541ad..891c1ebe 100644 --- a/vfs/osfs.go +++ b/vfs/osfs.go @@ -448,7 +448,7 @@ func (*OsFs) Close() error { return nil } -// GetAvailableDiskSize return the available size for the specified path +// GetAvailableDiskSize returns the available size for the specified path func (*OsFs) GetAvailableDiskSize(dirName string) (*sftp.StatVFS, error) { return getStatFS(dirName) } diff --git a/vfs/s3fs.go b/vfs/s3fs.go index 7a8273ba..578e4a82 100644 --- a/vfs/s3fs.go +++ b/vfs/s3fs.go @@ -914,7 +914,7 @@ func (*S3Fs) Close() error { return nil } -// GetAvailableDiskSize return the available size for the specified path +// GetAvailableDiskSize returns the available size for the specified path func (*S3Fs) GetAvailableDiskSize(dirName string) (*sftp.StatVFS, error) { return nil, ErrStorageSizeUnavailable } diff --git a/vfs/sftpfs.go b/vfs/sftpfs.go index fe78f348..99368ab8 100644 --- a/vfs/sftpfs.go +++ b/vfs/sftpfs.go @@ -678,7 +678,7 @@ func (fs *SFTPFs) GetMimeType(name string) (string, error) { return ctype, err } -// GetAvailableDiskSize return the available size for the specified path +// GetAvailableDiskSize returns the available size for the specified path func (fs *SFTPFs) GetAvailableDiskSize(dirName string) (*sftp.StatVFS, error) { if err := fs.checkConnection(); err != nil { return nil, err