Compare commits
No commits in common. "a2d09d8e688b5067c963858f738fa24f5f164503" and "56f98a9c1454359dfe2bda109adca06b19c7f7a6" have entirely different histories.
a2d09d8e68
...
56f98a9c14
2
main.go
2
main.go
@ -38,7 +38,7 @@ func ConnectDB() *sql.DB {
|
|||||||
func main() {
|
func main() {
|
||||||
csrfKey := []byte(os.Getenv("LENSLOCKED_CSRF_KEY"))
|
csrfKey := []byte(os.Getenv("LENSLOCKED_CSRF_KEY"))
|
||||||
if len(csrfKey) < 32 {
|
if len(csrfKey) < 32 {
|
||||||
panic("Error: bad csrf protection key\nPlease set a key with the LENSLOCKED_CSRF_KEY env var.")
|
panic("Error: bad csrf protection key")
|
||||||
}
|
}
|
||||||
|
|
||||||
db := ConnectDB()
|
db := ConnectDB()
|
||||||
|
|||||||
@ -42,11 +42,6 @@ func (t Template) TestTemplate(data interface{}) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
tpl = tpl.Funcs(template.FuncMap{
|
|
||||||
"csrfField": func() template.HTML {
|
|
||||||
return `<div class="hidden">STUB: PLACEHOLDER</div>`
|
|
||||||
},
|
|
||||||
})
|
|
||||||
return tpl.Execute(&testWriter, data)
|
return tpl.Execute(&testWriter, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,8 +52,8 @@ func FromFile(pattern ...string) (Template, error) {
|
|||||||
func FromFS(fs fs.FS, pattern ...string) (Template, error) {
|
func FromFS(fs fs.FS, pattern ...string) (Template, error) {
|
||||||
tpl := template.New(pattern[0])
|
tpl := template.New(pattern[0])
|
||||||
tpl = tpl.Funcs(template.FuncMap{
|
tpl = tpl.Funcs(template.FuncMap{
|
||||||
"csrfField": func() (template.HTML, error) {
|
"csrfField": func() template.HTML {
|
||||||
return `<div class="hidden">STUB: PLACEHOLDER</div>`, fmt.Errorf("csrfField Not Implimented")
|
return `<div class="hidden">STUB: PLACEHOLDER</div>`
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
tpl, err := tpl.ParseFS(fs, pattern...)
|
tpl, err := tpl.ParseFS(fs, pattern...)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user