Skip to content

Commit

Permalink
Fix preview custom auth screen templates
Browse files Browse the repository at this point in the history
  • Loading branch information
KinyaElGrande committed Sep 23, 2024
1 parent f9823a6 commit f2cdc1a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion server/auth/assets/templates/inc_header.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<style>
body {
font-size: 1rem !important;
{{ safeCSS .authBg }}
{{ .authBg }}
background-size: cover;
background-attachment: fixed;
}
Expand Down
1 change: 0 additions & 1 deletion server/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions server/auth/handlers/handle_dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package handlers

import (
"fmt"
"html/template"
"net/http"
"os"

Expand Down Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions server/auth/handlers/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/gob"
"fmt"
"github.com/cortezaproject/corteza/server/pkg/errors"
"html/template"
"io"
"mime/multipart"
Expand All @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit f2cdc1a

Please sign in to comment.