Fix csrf token unexported error
This commit is contained in:
parent
e8e42f3724
commit
8c93b3746b
@ -27,17 +27,17 @@ func (getController *GetController) ShowHome(w http.ResponseWriter, _ *http.Requ
|
|||||||
|
|
||||||
func (getController *GetController) ShowRegister(w http.ResponseWriter, r *http.Request) {
|
func (getController *GetController) ShowRegister(w http.ResponseWriter, r *http.Request) {
|
||||||
type dataStruct struct {
|
type dataStruct struct {
|
||||||
csrfToken string
|
CsrfToken string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create csrf token
|
// Create csrf token
|
||||||
csrfToken, err := security.GenerateCsrfToken(w, r)
|
CsrfToken, err := security.GenerateCsrfToken(w, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data := dataStruct{
|
data := dataStruct{
|
||||||
csrfToken: csrfToken,
|
CsrfToken: CsrfToken,
|
||||||
}
|
}
|
||||||
|
|
||||||
templating.RenderTemplate(getController.App, w, "templates/pages/register.html", data)
|
templating.RenderTemplate(getController.App, w, "templates/pages/register.html", data)
|
||||||
@ -45,17 +45,17 @@ func (getController *GetController) ShowRegister(w http.ResponseWriter, r *http.
|
|||||||
|
|
||||||
func (getController *GetController) ShowLogin(w http.ResponseWriter, r *http.Request) {
|
func (getController *GetController) ShowLogin(w http.ResponseWriter, r *http.Request) {
|
||||||
type dataStruct struct {
|
type dataStruct struct {
|
||||||
csrfToken string
|
CsrfToken string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create csrf token
|
// Create csrf token
|
||||||
csrfToken, err := security.GenerateCsrfToken(w, r)
|
CsrfToken, err := security.GenerateCsrfToken(w, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data := dataStruct{
|
data := dataStruct{
|
||||||
csrfToken: csrfToken,
|
CsrfToken: CsrfToken,
|
||||||
}
|
}
|
||||||
|
|
||||||
templating.RenderTemplate(getController.App, w, "templates/pages/login.html", data)
|
templating.RenderTemplate(getController.App, w, "templates/pages/login.html", data)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
{{ define "content" }}
|
{{ define "content" }}
|
||||||
<form action="/login-handle" method="post">
|
<form action="/login-handle" method="post">
|
||||||
<input name="csrf_token" type="hidden" value="{{ .csrfToken }}">
|
<input name="csrf_token" type="hidden" value="{{ .CsrfToken }}">
|
||||||
|
|
||||||
<label for="username">Username:</label><br>
|
<label for="username">Username:</label><br>
|
||||||
<input id="username" name="username" type="text" value="John"><br><br>
|
<input id="username" name="username" type="text" value="John"><br><br>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
{{ define "content" }}
|
{{ define "content" }}
|
||||||
<form action="/register-handle" method="post">
|
<form action="/register-handle" method="post">
|
||||||
<input name="csrf_token" type="hidden" value="{{ .csrfToken }}">
|
<input name="csrf_token" type="hidden" value="{{ .CsrfToken }}">
|
||||||
|
|
||||||
<label for="username">Username:</label><br>
|
<label for="username">Username:</label><br>
|
||||||
<input id="username" name="username" type="text" value="John"><br><br>
|
<input id="username" name="username" type="text" value="John"><br><br>
|
||||||
|
Loading…
Reference in New Issue
Block a user