You've already forked go-url-shortener
render html change templ
This commit is contained in:
11
internal/templ/funcs/authorize.go
Normal file
11
internal/templ/funcs/authorize.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package funcs
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/zhang2092/go-url-shortener/internal/middleware"
|
||||
)
|
||||
|
||||
func GetAuthorize(ctx context.Context) *middleware.Authorize {
|
||||
return middleware.GetUser(ctx)
|
||||
}
|
||||
12
internal/templ/funcs/csrf.go
Normal file
12
internal/templ/funcs/csrf.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package funcs
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/csrf"
|
||||
)
|
||||
|
||||
func CsrfField(r *http.Request) template.HTML {
|
||||
return csrf.TemplateField(r)
|
||||
}
|
||||
Reference in New Issue
Block a user