Przeglądaj źródła

UI branding: use the short name on the login pages

Signed-off-by: Nicola Murino <[email protected]>
Nicola Murino 3 lat temu
rodzic
commit
c9bd08cf9c

+ 1 - 1
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

+ 2 - 0
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

+ 1 - 0
httpd/web.go

@@ -31,6 +31,7 @@ type loginPage struct {
 	CSRFToken      string
 	StaticURL      string
 	AltLoginURL    string
+	AltLoginName   string
 	ForgotPwdURL   string
 	OpenIDLoginURL string
 	Branding       UIBranding

+ 2 - 2
templates/webadmin/login.html

@@ -4,7 +4,7 @@
 
 {{define "content"}}
                                     <div class="text-center">
-                                        <h1 class="h4 text-gray-900 mb-4">{{.Branding.Name}} - {{.Version}}</h1>
+                                        <h1 class="h4 text-gray-900 mb-4">{{.Branding.ShortName}} - {{.Version}}</h1>
                                     </div>
                                     {{if .Error}}
                                     <div class="card mb-4 border-left-warning">
@@ -40,7 +40,7 @@
                                     {{if .AltLoginURL}}
                                     <hr>
                                     <div class="text-center">
-                                        <a class="small" href="{{.AltLoginURL}}">Web Client</a>
+                                        <a class="small" href="{{.AltLoginURL}}">{{.AltLoginName}}</a>
                                     </div>
                                     {{end}}
                                     {{if and .Branding.DisclaimerName .Branding.DisclaimerPath}}

+ 1 - 1
templates/webclient/baselogin.html

@@ -48,7 +48,7 @@
                             <div class="col-lg-7">
                                 <div class="p-5">
                                     <div class="text-center">
-                                        <h1 class="h4 text-gray-900 mb-4">{{.Branding.Name}} - {{.Version}}</h1>
+                                        <h1 class="h4 text-gray-900 mb-4">{{.Branding.ShortName}} - {{.Version}}</h1>
                                     </div>
                                     {{template "content" .}}
                                 </div>

+ 1 - 1
templates/webclient/login.html

@@ -37,7 +37,7 @@
                                     {{if .AltLoginURL}}
                                     <hr>
                                     <div class="text-center">
-                                        <a class="small" href="{{.AltLoginURL}}">Web Admin</a>
+                                        <a class="small" href="{{.AltLoginURL}}">{{.AltLoginName}}</a>
                                     </div>
                                     {{end}}
                                     {{if and .Branding.DisclaimerName .Branding.DisclaimerPath}}

+ 1 - 1
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
 }

+ 1 - 1
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
 }

+ 1 - 1
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)
 }

+ 1 - 1
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
 }

+ 1 - 1
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