Fix csrf token unexported error

This commit is contained in:
Maximilian 2022-12-04 19:06:51 -06:00
parent e8e42f3724
commit 8c93b3746b
3 changed files with 8 additions and 8 deletions

View File

@ -27,17 +27,17 @@ func (getController *GetController) ShowHome(w http.ResponseWriter, _ *http.Requ
func (getController *GetController) ShowRegister(w http.ResponseWriter, r *http.Request) {
type dataStruct struct {
csrfToken string
CsrfToken string
}
// Create csrf token
csrfToken, err := security.GenerateCsrfToken(w, r)
CsrfToken, err := security.GenerateCsrfToken(w, r)
if err != nil {
return
}
data := dataStruct{
csrfToken: csrfToken,
CsrfToken: CsrfToken,
}
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) {
type dataStruct struct {
csrfToken string
CsrfToken string
}
// Create csrf token
csrfToken, err := security.GenerateCsrfToken(w, r)
CsrfToken, err := security.GenerateCsrfToken(w, r)
if err != nil {
return
}
data := dataStruct{
csrfToken: csrfToken,
CsrfToken: CsrfToken,
}
templating.RenderTemplate(getController.App, w, "templates/pages/login.html", data)

View File

@ -2,7 +2,7 @@
{{ define "content" }}
<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>
<input id="username" name="username" type="text" value="John"><br><br>

View File

@ -2,7 +2,7 @@
{{ define "content" }}
<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>
<input id="username" name="username" type="text" value="John"><br><br>