Browse Source

web UIs: move common css to a separate template file

so we can reuse it instead of copying the same CSS every time

Signed-off-by: Nicola Murino <[email protected]>
Nicola Murino 3 years ago
parent
commit
67abf03fe3

+ 23 - 21
dataprovider/sqlcommon.go

@@ -649,8 +649,7 @@ func sqlCommonDumpGroups(dbHandle sqlQuerier) ([]Group, error) {
 		group.PrepareForRendering()
 		groups = append(groups, group)
 	}
-	err = rows.Err()
-	return groups, err
+	return groups, rows.Err()
 }
 
 func sqlCommonGetUsersInGroups(names []string, dbHandle sqlQuerier) ([]string, error) {
@@ -675,16 +674,18 @@ func sqlCommonGetUsersInGroups(names []string, dbHandle sqlQuerier) ([]string, e
 
 	usernames := make([]string, 0, len(names))
 	rows, err := stmt.QueryContext(ctx, args...)
-	if err == nil {
-		defer rows.Close()
-		for rows.Next() {
-			var username string
-			err = rows.Scan(&username)
-			if err != nil {
-				return usernames, err
-			}
-			usernames = append(usernames, username)
+	if err != nil {
+		return nil, err
+	}
+	defer rows.Close()
+
+	for rows.Next() {
+		var username string
+		err = rows.Scan(&username)
+		if err != nil {
+			return usernames, err
 		}
+		usernames = append(usernames, username)
 	}
 	return usernames, rows.Err()
 }
@@ -711,15 +712,17 @@ func sqlCommonGetGroupsWithNames(names []string, dbHandle sqlQuerier) ([]Group,
 
 	groups := make([]Group, 0, len(names))
 	rows, err := stmt.QueryContext(ctx, args...)
-	if err == nil {
-		defer rows.Close()
-		for rows.Next() {
-			group, err := getGroupFromDbRow(rows)
-			if err != nil {
-				return groups, err
-			}
-			groups = append(groups, group)
+	if err != nil {
+		return groups, err
+	}
+	defer rows.Close()
+
+	for rows.Next() {
+		group, err := getGroupFromDbRow(rows)
+		if err != nil {
+			return groups, err
 		}
+		groups = append(groups, group)
 	}
 	err = rows.Err()
 	if err != nil {
@@ -2200,8 +2203,7 @@ func sqlCommonDumpFolders(dbHandle sqlQuerier) ([]vfs.BaseVirtualFolder, error)
 		}
 		folders = append(folders, folder)
 	}
-	err = rows.Err()
-	return folders, err
+	return folders, rows.Err()
 }
 
 func sqlCommonGetFolders(limit, offset int, order string, minimal bool, dbHandle sqlQuerier) ([]vfs.BaseVirtualFolder, error) {

+ 5 - 5
go.mod

@@ -65,9 +65,9 @@ require (
 	go.uber.org/automaxprocs v1.5.1
 	gocloud.dev v0.25.0
 	golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88
-	golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4
+	golang.org/x/net v0.0.0-20220513224357-95641704303c
 	golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
-	golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6
+	golang.org/x/sys v0.0.0-20220513210249-45d2b4557a2a
 	golang.org/x/time v0.0.0-20220411224347-583f2d630306
 	google.golang.org/api v0.79.0
 	gopkg.in/natefinch/lumberjack.v2 v2.0.0
@@ -153,7 +153,7 @@ require (
 	golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
 	google.golang.org/appengine v1.6.7 // indirect
 	google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3 // indirect
-	google.golang.org/grpc v1.46.0 // indirect
+	google.golang.org/grpc v1.46.2 // indirect
 	google.golang.org/protobuf v1.28.0 // indirect
 	gopkg.in/ini.v1 v1.66.4 // indirect
 	gopkg.in/square/go-jose.v2 v2.6.0 // indirect
@@ -163,6 +163,6 @@ require (
 
 replace (
 	github.com/jlaffaye/ftp => github.com/drakkan/ftp v0.0.0-20201114075148-9b9adce499a9
-	golang.org/x/crypto => github.com/drakkan/crypto v0.0.0-20220505051548-eb52ab1741ed
-	golang.org/x/net => github.com/drakkan/net v0.0.0-20220504073018-5d1702f4106f
+	golang.org/x/crypto => github.com/drakkan/crypto v0.0.0-20220514091251-ad79d832b8dc
+	golang.org/x/net => github.com/drakkan/net v0.0.0-20220514085754-d827943a3fff
 )

+ 8 - 6
go.sum

@@ -250,12 +250,12 @@ github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQ
 github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
 github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
 github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
-github.com/drakkan/crypto v0.0.0-20220505051548-eb52ab1741ed h1:08cqWe9aKRNPpH5nfTyAVoitSif6pvXbGa9v3+PDAzI=
-github.com/drakkan/crypto v0.0.0-20220505051548-eb52ab1741ed/go.mod h1:SiM6ypd8Xu1xldObYtbDztuUU7xUzMnUULfphXFZmro=
+github.com/drakkan/crypto v0.0.0-20220514091251-ad79d832b8dc h1:RZGYMm4+aQbbGUecIKYQk4d+tYBePbB23v0QDrNXf4w=
+github.com/drakkan/crypto v0.0.0-20220514091251-ad79d832b8dc/go.mod h1:SiM6ypd8Xu1xldObYtbDztuUU7xUzMnUULfphXFZmro=
 github.com/drakkan/ftp v0.0.0-20201114075148-9b9adce499a9 h1:LPH1dEblAOO/LoG7yHPMtBLXhQmjaga91/DDjWk9jWA=
 github.com/drakkan/ftp v0.0.0-20201114075148-9b9adce499a9/go.mod h1:2lmrmq866uF2tnje75wQHzmPXhmSWUt7Gyx2vgK1RCU=
-github.com/drakkan/net v0.0.0-20220504073018-5d1702f4106f h1:BUIQ/l47ZPdruH1S17AdCCq6YNR/DyLpvysRXikD/Xg=
-github.com/drakkan/net v0.0.0-20220504073018-5d1702f4106f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
+github.com/drakkan/net v0.0.0-20220514085754-d827943a3fff h1:en4qoYF7ceYxP1OkTSdbAO87JA9ruqdvKLV2KHviiNM=
+github.com/drakkan/net v0.0.0-20220514085754-d827943a3fff/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
 github.com/eikenb/pipeat v0.0.0-20210730190139-06b3e6902001 h1:/ZshrfQzayqRSBDodmp3rhNCHJCff+utvgBuWRbiqu4=
 github.com/eikenb/pipeat v0.0.0-20210730190139-06b3e6902001/go.mod h1:kltMsfRMTHSFdMbK66XdS8mfMW77+FZA1fGY1xYMF84=
 github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@@ -964,8 +964,9 @@ golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBc
 golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 h1:nonptSpoQ4vQjyraW20DXPAglgQfVnM9ZC6MmNLMR60=
 golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220513210249-45d2b4557a2a h1:N2T1jUrTQE9Re6TFF5PhvEHXHCguynGhKjWVsIUt5cY=
+golang.org/x/sys v0.0.0-20220513210249-45d2b4557a2a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
@@ -1235,8 +1236,9 @@ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K
 google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
 google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
 google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ=
-google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8=
 google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
+google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ=
+google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
 google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
 google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=

+ 1 - 0
httpd/web.go

@@ -21,6 +21,7 @@ const (
 	templateTwoFactorRecovery = "twofactor-recovery.html"
 	templateForgotPassword    = "forgot-password.html"
 	templateResetPassword     = "reset-password.html"
+	templateCommonCSS         = "sftpgo.css"
 )
 
 type loginPage struct {

+ 22 - 0
httpd/webadmin.go

@@ -277,94 +277,116 @@ type userTemplateFields struct {
 
 func loadAdminTemplates(templatesPath string) {
 	usersPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateUsers),
 	}
 	userPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateSharedComponents),
 		filepath.Join(templatesPath, templateAdminDir, templateFsConfig),
 		filepath.Join(templatesPath, templateAdminDir, templateUser),
 	}
 	adminsPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateAdmins),
 	}
 	adminPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateAdmin),
 	}
 	profilePaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateProfile),
 	}
 	changePwdPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateChangePwd),
 	}
 	connectionsPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateConnections),
 	}
 	messagePaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateMessage),
 	}
 	foldersPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateFolders),
 	}
 	folderPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateFsConfig),
 		filepath.Join(templatesPath, templateAdminDir, templateFolder),
 	}
 	groupsPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateGroups),
 	}
 	groupPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateFsConfig),
 		filepath.Join(templatesPath, templateAdminDir, templateSharedComponents),
 		filepath.Join(templatesPath, templateAdminDir, templateGroup),
 	}
 	statusPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateStatus),
 	}
 	loginPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBaseLogin),
 		filepath.Join(templatesPath, templateAdminDir, templateLogin),
 	}
 	maintenancePaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateMaintenance),
 	}
 	defenderPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateDefender),
 	}
 	mfaPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBase),
 		filepath.Join(templatesPath, templateAdminDir, templateMFA),
 	}
 	twoFactorPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBaseLogin),
 		filepath.Join(templatesPath, templateAdminDir, templateTwoFactor),
 	}
 	twoFactorRecoveryPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBaseLogin),
 		filepath.Join(templatesPath, templateAdminDir, templateTwoFactorRecovery),
 	}
 	setupPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateAdminDir, templateBaseLogin),
 		filepath.Join(templatesPath, templateAdminDir, templateSetup),
 	}
 	forgotPwdPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateCommonDir, templateForgotPassword),
 	}
 	resetPwdPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateCommonDir, templateResetPassword),
 	}
 

+ 16 - 0
httpd/webclient.go

@@ -217,63 +217,79 @@ func getFileObjectModTime(t time.Time) string {
 
 func loadClientTemplates(templatesPath string) {
 	filesPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateClientDir, templateClientBase),
 		filepath.Join(templatesPath, templateClientDir, templateClientFiles),
 	}
 	editFilePath := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateClientDir, templateClientBase),
 		filepath.Join(templatesPath, templateClientDir, templateClientEditFile),
 	}
 	sharesPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateClientDir, templateClientBase),
 		filepath.Join(templatesPath, templateClientDir, templateClientShares),
 	}
 	sharePaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateClientDir, templateClientBase),
 		filepath.Join(templatesPath, templateClientDir, templateClientShare),
 	}
 	profilePaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateClientDir, templateClientBase),
 		filepath.Join(templatesPath, templateClientDir, templateClientProfile),
 	}
 	changePwdPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateClientDir, templateClientBase),
 		filepath.Join(templatesPath, templateClientDir, templateClientChangePwd),
 	}
 	loginPath := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateClientDir, templateClientBaseLogin),
 		filepath.Join(templatesPath, templateClientDir, templateClientLogin),
 	}
 	messagePath := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateClientDir, templateClientBase),
 		filepath.Join(templatesPath, templateClientDir, templateClientMessage),
 	}
 	mfaPath := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateClientDir, templateClientBase),
 		filepath.Join(templatesPath, templateClientDir, templateClientMFA),
 	}
 	twoFactorPath := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateClientDir, templateClientBaseLogin),
 		filepath.Join(templatesPath, templateClientDir, templateClientTwoFactor),
 	}
 	twoFactorRecoveryPath := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateClientDir, templateClientBaseLogin),
 		filepath.Join(templatesPath, templateClientDir, templateClientTwoFactorRecovery),
 	}
 	forgotPwdPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateCommonDir, templateForgotPassword),
 	}
 	resetPwdPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateCommonDir, templateResetPassword),
 	}
 	viewPDFPaths := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateClientDir, templateClientViewPDF),
 	}
 	shareFilesPath := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateClientDir, templateClientBase),
 		filepath.Join(templatesPath, templateClientDir, templateShareFiles),
 	}
 	shareUploadPath := []string{
+		filepath.Join(templatesPath, templateCommonDir, templateCommonCSS),
 		filepath.Join(templatesPath, templateClientDir, templateClientBase),
 		filepath.Join(templatesPath, templateClientDir, templateUploadToShare),
 	}

+ 1 - 52
templates/common/forgot-password.html

@@ -16,58 +16,7 @@
     <!-- Custom styles for this template-->
     <link href="{{.StaticURL}}/css/sb-admin-2.min.css" rel="stylesheet">
     <style>
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Bold-webfont.woff');
-            font-weight: 700;
-            font-style: normal;
-        }
-
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Regular-webfont.woff');
-            font-weight: 400;
-            font-style: normal;
-        }
-
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Light-webfont.woff');
-            font-weight: 300;
-            font-style: normal;
-        }
-
-        div.dt-buttons {
-            margin-bottom: 1em;
-        }
-
-        .text-form-error {
-            color: var(--red) !important;
-        }
-
-        div.dt-buttons {
-            margin-bottom: 1em;
-        }
-
-        .text-form-error {
-            color: var(--red) !important;
-        }
-
-        form.user-custom .custom-checkbox.small label {
-            line-height: 1.5rem;
-        }
-
-        form.user-custom .form-control-user-custom {
-            font-size: 0.9rem;
-            border-radius: 10rem;
-            padding: 1.5rem 1rem;
-        }
-
-        form.user-custom .btn-user-custom {
-            font-size: 0.9rem;
-            border-radius: 10rem;
-            padding: 0.75rem 1rem;
-        }
+        {{template "commoncss" .}}
     </style>
 
     {{range .Branding.ExtraCSS}}

+ 1 - 52
templates/common/reset-password.html

@@ -16,58 +16,7 @@
     <!-- Custom styles for this template-->
     <link href="{{.StaticURL}}/css/sb-admin-2.min.css" rel="stylesheet">
     <style>
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Bold-webfont.woff');
-            font-weight: 700;
-            font-style: normal;
-        }
-
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Regular-webfont.woff');
-            font-weight: 400;
-            font-style: normal;
-        }
-
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Light-webfont.woff');
-            font-weight: 300;
-            font-style: normal;
-        }
-
-        div.dt-buttons {
-            margin-bottom: 1em;
-        }
-
-        .text-form-error {
-            color: var(--red) !important;
-        }
-
-        div.dt-buttons {
-            margin-bottom: 1em;
-        }
-
-        .text-form-error {
-            color: var(--red) !important;
-        }
-
-        form.user-custom .custom-checkbox.small label {
-            line-height: 1.5rem;
-        }
-
-        form.user-custom .form-control-user-custom {
-            font-size: 0.9rem;
-            border-radius: 10rem;
-            padding: 1.5rem 1rem;
-        }
-
-        form.user-custom .btn-user-custom {
-            font-size: 0.9rem;
-            border-radius: 10rem;
-            padding: 0.75rem 1rem;
-        }
+        {{template "commoncss" .}}
     </style>
 
     {{range .Branding.ExtraCSS}}

+ 57 - 0
templates/common/sftpgo.css

@@ -0,0 +1,57 @@
+{{define "commoncss"}}
+        @font-face {
+            font-family: 'Roboto';
+            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Bold-webfont.woff');
+            font-weight: 700;
+            font-style: normal;
+        }
+
+        @font-face {
+            font-family: 'Roboto';
+            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Regular-webfont.woff');
+            font-weight: 400;
+            font-style: normal;
+        }
+
+        @font-face {
+            font-family: 'Roboto';
+            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Light-webfont.woff');
+            font-weight: 300;
+            font-style: normal;
+        }
+
+        div.dt-buttons {
+            margin-bottom: 1em;
+        }
+
+        .text-form-error {
+            color: var(--red) !important;
+        }
+
+        form.user-custom .custom-checkbox.small label {
+            line-height: 1.5rem;
+        }
+
+        form.user-custom .form-control-user-custom {
+            font-size: 0.9rem;
+            border-radius: 10rem;
+            padding: 1.5rem 1rem;
+        }
+
+        form.user-custom .btn-user-custom {
+            font-size: 0.9rem;
+            border-radius: 10rem;
+            padding: 0.75rem 1rem;
+        }
+
+        .bg-login-image {
+            background-image: url('{{.StaticURL}}{{.Branding.LoginImagePath}}');
+            background-size: contain;
+            background-repeat: no-repeat;
+            padding: 1em;
+        }
+
+        .row.login-image {
+            height: 200px;
+        }
+{{end}}

+ 1 - 52
templates/webadmin/adminsetup.html

@@ -16,58 +16,7 @@
     <!-- Custom styles for this template-->
     <link href="{{.StaticURL}}/css/sb-admin-2.min.css" rel="stylesheet">
     <style>
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Bold-webfont.woff');
-            font-weight: 700;
-            font-style: normal;
-        }
-
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Regular-webfont.woff');
-            font-weight: 400;
-            font-style: normal;
-        }
-
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Light-webfont.woff');
-            font-weight: 300;
-            font-style: normal;
-        }
-
-        div.dt-buttons {
-            margin-bottom: 1em;
-        }
-
-        .text-form-error {
-            color: var(--red) !important;
-        }
-
-        div.dt-buttons {
-            margin-bottom: 1em;
-        }
-
-        .text-form-error {
-            color: var(--red) !important;
-        }
-
-        form.user-custom .custom-checkbox.small label {
-            line-height: 1.5rem;
-        }
-
-        form.user-custom .form-control-user-custom {
-            font-size: 0.9rem;
-            border-radius: 10rem;
-            padding: 1.5rem 1rem;
-        }
-
-        form.user-custom .btn-user-custom {
-            font-size: 0.9rem;
-            border-radius: 10rem;
-            padding: 0.75rem 1rem;
-        }
+        {{template "commoncss" .}}
     </style>
 
 </head>

+ 1 - 28
templates/webadmin/base.html

@@ -22,34 +22,7 @@
     <!-- Custom styles for this template-->
     <link href="{{.StaticURL}}/css/sb-admin-2.min.css" rel="stylesheet">
     <style>
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Bold-webfont.woff');
-            font-weight: 700;
-            font-style: normal;
-        }
-
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Regular-webfont.woff');
-            font-weight: 400;
-            font-style: normal;
-        }
-
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Light-webfont.woff');
-            font-weight: 300;
-            font-style: normal;
-        }
-
-        div.dt-buttons {
-            margin-bottom: 1em;
-        }
-
-        .text-form-error {
-            color: var(--red) !important;
-        }
+        {{template "commoncss" .}}
     </style>
     {{block "extra_css" .}}{{end}}
 

+ 1 - 64
templates/webadmin/baselogin.html

@@ -16,71 +16,8 @@
 
     <!-- Custom styles for this template-->
     <link href="{{.StaticURL}}/css/sb-admin-2.min.css" rel="stylesheet">
-    <link href="{{.StaticURL}}/css/sftpgo.css" rel="stylesheet">
     <style>
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Bold-webfont.woff');
-            font-weight: 700;
-            font-style: normal;
-        }
-
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Regular-webfont.woff');
-            font-weight: 400;
-            font-style: normal;
-        }
-
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Light-webfont.woff');
-            font-weight: 300;
-            font-style: normal;
-        }
-
-        div.dt-buttons {
-            margin-bottom: 1em;
-        }
-
-        .text-form-error {
-            color: var(--red) !important;
-        }
-
-        div.dt-buttons {
-            margin-bottom: 1em;
-        }
-
-        .text-form-error {
-            color: var(--red) !important;
-        }
-
-        form.user-custom .custom-checkbox.small label {
-            line-height: 1.5rem;
-        }
-
-        form.user-custom .form-control-user-custom {
-            font-size: 0.9rem;
-            border-radius: 10rem;
-            padding: 1.5rem 1rem;
-        }
-
-        form.user-custom .btn-user-custom {
-            font-size: 0.9rem;
-            border-radius: 10rem;
-            padding: 0.75rem 1rem;
-        }
-
-        .bg-login-image {
-            background-image: url('{{.StaticURL}}{{.Branding.LoginImagePath}}');
-            background-size: contain;
-            background-repeat: no-repeat;
-            padding: 1em;
-        }
-
-        .row.login-image {
-            height: 200px;
-        }
+        {{template "commoncss" .}}
     </style>
 
     {{range .Branding.ExtraCSS}}

+ 1 - 28
templates/webclient/base.html

@@ -22,34 +22,7 @@
     <!-- Custom styles for this template-->
     <link href="{{.StaticURL}}/css/sb-admin-2.min.css" rel="stylesheet">
     <style>
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Bold-webfont.woff');
-            font-weight: 700;
-            font-style: normal;
-        }
-
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Regular-webfont.woff');
-            font-weight: 400;
-            font-style: normal;
-        }
-
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Light-webfont.woff');
-            font-weight: 300;
-            font-style: normal;
-        }
-
-        div.dt-buttons {
-            margin-bottom: 1em;
-        }
-
-        .text-form-error {
-            color: var(--red) !important;
-        }
+        {{template "commoncss" .}}
     </style>
     {{block "extra_css" .}}{{end}}
 

+ 1 - 64
templates/webclient/baselogin.html

@@ -16,71 +16,8 @@
 
     <!-- Custom styles for this template-->
     <link href="{{.StaticURL}}/css/sb-admin-2.min.css" rel="stylesheet">
-    <link href="{{.StaticURL}}/css/sftpgo.css" rel="stylesheet">
     <style>
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Bold-webfont.woff');
-            font-weight: 700;
-            font-style: normal;
-        }
-
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Regular-webfont.woff');
-            font-weight: 400;
-            font-style: normal;
-        }
-
-        @font-face {
-            font-family: 'Roboto';
-            src: url('{{.StaticURL}}/vendor/fonts/Roboto-Light-webfont.woff');
-            font-weight: 300;
-            font-style: normal;
-        }
-
-        div.dt-buttons {
-            margin-bottom: 1em;
-        }
-
-        .text-form-error {
-            color: var(--red) !important;
-        }
-
-        div.dt-buttons {
-            margin-bottom: 1em;
-        }
-
-        .text-form-error {
-            color: var(--red) !important;
-        }
-
-        form.user-custom .custom-checkbox.small label {
-            line-height: 1.5rem;
-        }
-
-        form.user-custom .form-control-user-custom {
-            font-size: 0.9rem;
-            border-radius: 10rem;
-            padding: 1.5rem 1rem;
-        }
-
-        form.user-custom .btn-user-custom {
-            font-size: 0.9rem;
-            border-radius: 10rem;
-            padding: 0.75rem 1rem;
-        }
-
-        .bg-login-image {
-            background-image: url('{{.StaticURL}}{{.Branding.LoginImagePath}}');
-            background-size: contain;
-            background-repeat: no-repeat;
-            padding: 1em;
-        }
-
-        .row.login-image {
-            height: 200px;
-        }
+        {{template "commoncss"  .}}
     </style>
 
     {{range .Branding.ExtraCSS}}