mirror of
https://github.com/writefreely/writefreely
synced 2024-11-10 19:34:19 +00:00
Include flashes on signup page
This commit is contained in:
parent
c800f8c9a2
commit
5a062eb437
1 changed files with 20 additions and 1 deletions
21
app.go
21
app.go
|
@ -5,6 +5,7 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
|
@ -64,8 +65,26 @@ func handleViewHome(app *app, w http.ResponseWriter, r *http.Request) error {
|
|||
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
|
||||
return renderPage(w, "landing.tmpl", pageForReq(app, r))
|
||||
return renderPage(w, "landing.tmpl", p)
|
||||
}
|
||||
|
||||
func pageForReq(app *app, r *http.Request) page.StaticPage {
|
||||
|
|
Loading…
Reference in a new issue