QR codes complete, account settings finished!
+ refactored templates a little; this might need more work!
This commit is contained in:
parent
1edc051ae2
commit
3450d879ac
13 changed files with 175 additions and 135 deletions
|
@ -20,7 +20,7 @@ func Handler(app *model.AppState) http.Handler {
|
|||
mux := http.NewServeMux()
|
||||
|
||||
mux.Handle("/qr-test", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
qrB64Img, err := controller.GenerateQRCode([]byte("super epic mega gaming test message. be sure to buy free2play on bandcamp so i can put food on my family"))
|
||||
qrB64Img, err := controller.GenerateQRCode("super epic mega gaming test message. be sure to buy free2play on bandcamp so i can put food on my family")
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "WARN: Failed to generate QR code: %v\n", err)
|
||||
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||
|
@ -87,7 +87,7 @@ func AdminIndexHandler(app *model.AppState) http.Handler {
|
|||
Tracks []*model.Track
|
||||
}
|
||||
|
||||
err = pages["index"].Execute(w, IndexData{
|
||||
err = indexTemplate.Execute(w, IndexData{
|
||||
Session: session,
|
||||
Releases: releases,
|
||||
Artists: artists,
|
||||
|
@ -116,7 +116,7 @@ func registerAccountHandler(app *model.AppState) http.Handler {
|
|||
}
|
||||
|
||||
render := func() {
|
||||
err := pages["register"].Execute(w, registerData{ Session: session })
|
||||
err := registerTemplate.Execute(w, registerData{ Session: session })
|
||||
if err != nil {
|
||||
fmt.Printf("WARN: Error rendering create account page: %s\n", err)
|
||||
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||
|
@ -229,7 +229,7 @@ func loginHandler(app *model.AppState) http.Handler {
|
|||
}
|
||||
|
||||
render := func() {
|
||||
err := pages["login"].Execute(w, loginData{ Session: session })
|
||||
err := loginTemplate.Execute(w, loginData{ Session: session })
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "WARN: Error rendering admin login page: %s\n", err)
|
||||
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||
|
@ -307,7 +307,7 @@ func loginHandler(app *model.AppState) http.Handler {
|
|||
Username string
|
||||
Password string
|
||||
}
|
||||
err = pages["login-totp"].Execute(w, loginTOTPData{
|
||||
err = loginTOTPTemplate.Execute(w, loginTOTPData{
|
||||
Session: session,
|
||||
Username: credentials.Username,
|
||||
Password: credentials.Password,
|
||||
|
@ -379,7 +379,7 @@ func logoutHandler(app *model.AppState) http.Handler {
|
|||
Path: "/",
|
||||
})
|
||||
|
||||
err = pages["logout"].Execute(w, nil)
|
||||
err = logoutTemplate.Execute(w, nil)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "WARN: Failed to render logout page: %v\n", err)
|
||||
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue