diff options
| author | horus_arch | 2015-03-20 23:16:27 +0100 |
|---|---|---|
| committer | horus_arch | 2015-03-20 23:16:27 +0100 |
| commit | 491462e033ae78a5b5c4f93ed8d5663e4da0a9e3 (patch) | |
| tree | cdc82ee4c600a86ba6bc7b92a589b129a01c7429 /handler.go | |
| parent | 17bea88eb3f6e2bc5f63641437a997cc8bd32881 (diff) | |
| download | freemail-491462e033ae78a5b5c4f93ed8d5663e4da0a9e3.tar.gz | |
Fix bug which prevented creating a new entry.
Diffstat (limited to 'handler.go')
| -rw-r--r-- | handler.go | 32 |
1 files changed, 30 insertions, 2 deletions
@@ -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 } |
