summaryrefslogtreecommitdiff
path: root/handler.go
diff options
context:
space:
mode:
Diffstat (limited to 'handler.go')
-rw-r--r--handler.go32
1 files changed, 30 insertions, 2 deletions
diff --git a/handler.go b/handler.go
index 4e077db..dd761e4 100644
--- a/handler.go
+++ b/handler.go
@@ -16,11 +16,39 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) {
flash.Success = session.Flashes("success")
session.Save(r, w)
- index := mainTempl.Lookup("index.html")
+ /*
+ index := mainTempl.Lookup("index.html")
- err = index.ExecuteTemplate(w, "index.html", flash)
+ err = index.ExecuteTemplate(w, "index.html", flash)
+ if err != nil {
+ log.Println(err)
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+ */
+
+ err = ExecTemplate("index.html", w, flash)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+
+ session.Save(r, w)
+}
+
+func RegisterHandler(w http.ResponseWriter, r *http.Request) {
+ session, err := store.Get(r, "_SID")
if err != nil {
log.Println(err)
+ }
+
+ flash := Flash{}
+ flash.Error = session.Flashes("error")
+ flash.Success = session.Flashes("success")
+ session.Save(r, w)
+
+ err = ExecTemplate("register.html", w, flash)
+ if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}