Include flashes on signup page
This commit is contained in:
parent
c800f8c9a2
commit
5a062eb437
21
app.go
21
app.go
|
@ -5,6 +5,7 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
@ -64,8 +65,26 @@ func handleViewHome(app *app, w http.ResponseWriter, r *http.Request) error {
|
||||||
return handleViewPad(app, w, r)
|
return handleViewPad(app, w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p := struct {
|
||||||
|
page.StaticPage
|
||||||
|
Flashes []template.HTML
|
||||||
|
}{
|
||||||
|
StaticPage: pageForReq(app, r),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get error messages
|
||||||
|
session, err := app.sessionStore.Get(r, cookieName)
|
||||||
|
if err != nil {
|
||||||
|
// Ignore this
|
||||||
|
log.Error("Unable to get session in handleViewHome; ignoring: %v", err)
|
||||||
|
}
|
||||||
|
flashes, _ := getSessionFlashes(app, w, r, session)
|
||||||
|
for _, flash := range flashes {
|
||||||
|
p.Flashes = append(p.Flashes, template.HTML(flash))
|
||||||
|
}
|
||||||
|
|
||||||
// Show landing page
|
// Show landing page
|
||||||
return renderPage(w, "landing.tmpl", pageForReq(app, r))
|
return renderPage(w, "landing.tmpl", p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func pageForReq(app *app, r *http.Request) page.StaticPage {
|
func pageForReq(app *app, r *http.Request) page.StaticPage {
|
||||||
|
|
Loading…
Reference in New Issue