work on registration form
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package webcontroller
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
@@ -9,6 +10,7 @@ import (
|
||||
type TemplateData struct {
|
||||
Authenticated bool
|
||||
Username string
|
||||
APIEndpoint template.URL
|
||||
|
||||
Recaptcha struct {
|
||||
Enabled bool
|
||||
@@ -18,8 +20,12 @@ type TemplateData struct {
|
||||
Other interface{}
|
||||
}
|
||||
|
||||
func (wc *WebController) newTemplateData(r http.Request) *TemplateData {
|
||||
var t = &TemplateData{}
|
||||
func (wc *WebController) newTemplateData(r *http.Request) *TemplateData {
|
||||
var t = &TemplateData{
|
||||
Authenticated: false,
|
||||
Username: "Fornax",
|
||||
APIEndpoint: template.URL(wc.conf.APIURLExternal),
|
||||
}
|
||||
|
||||
return t
|
||||
}
|
||||
|
@@ -1,15 +1 @@
|
||||
package webcontroller
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/julienschmidt/httprouter"
|
||||
)
|
||||
|
||||
func (wc *WebController) handleLogin(
|
||||
w http.ResponseWriter,
|
||||
r *http.Request,
|
||||
p httprouter.Params,
|
||||
) {
|
||||
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ func (wc *WebController) serveTemplate(tpl string) httprouter.Handle {
|
||||
r *http.Request,
|
||||
p httprouter.Params,
|
||||
) {
|
||||
err := wc.templates.Get().ExecuteTemplate(w, tpl, nil)
|
||||
err := wc.templates.Get().ExecuteTemplate(w, tpl, wc.newTemplateData(r))
|
||||
if err != nil {
|
||||
log.Error("Error executing template '%s': %s", tpl, err)
|
||||
}
|
||||
@@ -80,5 +80,5 @@ func (wc *WebController) serveFile(path string) httprouter.Handle {
|
||||
|
||||
func (wc *WebController) serveNotFound(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("Not Found: %s", r.URL)
|
||||
wc.templates.Get().ExecuteTemplate(w, "error", nil)
|
||||
wc.templates.Get().ExecuteTemplate(w, "error", wc.newTemplateData(r))
|
||||
}
|
||||
|
Reference in New Issue
Block a user