3
0

Fix preview custom auth screen templates

This commit is contained in:
Mumbi Francis 2024-09-13 15:09:15 +03:00 committed by Mumbi Francis
parent f9823a6c5d
commit f2cdc1a586
4 changed files with 9 additions and 4 deletions

View File

@ -21,7 +21,7 @@
<style>
body {
font-size: 1rem !important;
{{ safeCSS .authBg }}
{{ .authBg }}
background-size: cover;
background-attachment: fixed;
}

View File

@ -143,7 +143,6 @@ func New(ctx context.Context, log *zap.Logger, oa2m oauth2def.Manager, s store.S
// temp, will be replaced
"language": func() string { return language.Tag{}.String() },
"tr": func(key string, pp ...string) string { return key },
"safeCSS": func(styles string) template.CSS { return template.CSS(styles) },
})
useEmbedded = len(opt.AssetsPath) == 0

View File

@ -6,6 +6,7 @@ package handlers
import (
"fmt"
"html/template"
"net/http"
"os"
@ -42,8 +43,13 @@ func (h *AuthHandlers) devSceneView(w http.ResponseWriter, r *http.Request) {
r.URL.Query().Get("scene"),
)
s.Data["authBg"] = template.CSS(h.bgStylesData())
if err == nil && s != nil {
err = h.Templates.ExecuteTemplate(w, s.Template+".html.tpl", s.Data)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
return
}

View File

@ -4,7 +4,6 @@ import (
"context"
"encoding/gob"
"fmt"
"github.com/cortezaproject/corteza/server/pkg/errors"
"html/template"
"io"
"mime/multipart"
@ -20,6 +19,7 @@ import (
"github.com/cortezaproject/corteza/server/auth/saml"
"github.com/cortezaproject/corteza/server/auth/settings"
"github.com/cortezaproject/corteza/server/pkg/auth"
"github.com/cortezaproject/corteza/server/pkg/errors"
"github.com/cortezaproject/corteza/server/pkg/locale"
"github.com/cortezaproject/corteza/server/pkg/options"
"github.com/cortezaproject/corteza/server/system/types"
@ -411,7 +411,7 @@ func (h *AuthHandlers) enrichTmplData(req *request.AuthReq) interface{} {
dSettings.Providers = nil
d["settings"] = dSettings
d["authBg"] = h.bgStylesData()
d["authBg"] = template.CSS(h.bgStylesData())
return d
}