summaryrefslogtreecommitdiff
path: root/handler.go
diff options
context:
space:
mode:
authorhorus_arch2015-03-20 23:16:27 +0100
committerhorus_arch2015-03-20 23:16:27 +0100
commit491462e033ae78a5b5c4f93ed8d5663e4da0a9e3 (patch)
treecdc82ee4c600a86ba6bc7b92a589b129a01c7429 /handler.go
parent17bea88eb3f6e2bc5f63641437a997cc8bd32881 (diff)
downloadfreemail-491462e033ae78a5b5c4f93ed8d5663e4da0a9e3.tar.gz
Fix bug which prevented creating a new entry.
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
}