diff --git a/snippetbox/cmd/web/handlers.go b/snippetbox/cmd/web/handlers.go index 0af9a43..d6bfef5 100644 --- a/snippetbox/cmd/web/handlers.go +++ b/snippetbox/cmd/web/handlers.go @@ -184,6 +184,9 @@ func (app *application) userLoginPost(w http.ResponseWriter, r *http.Request) { return } + + app.sessionManager.Put(r.Context(), "authenticatedUserID", 1) + app.sessionManager.Put(r.Context(), "flash", fmt.Sprintf("LOGGED IN USER %s! (not really)", form.Username)) http.Redirect(w, r, "/", http.StatusSeeOther) @@ -193,6 +196,6 @@ func (app *application) userLoginPost(w http.ResponseWriter, r *http.Request) { func (app *application) userLogoutPost(w http.ResponseWriter, r *http.Request) { id := app.sessionManager.PopInt(r.Context(), "authenticatedUserID") - app.sessionManager.Put(r.Context(), "flash", fmt.Sprintf("LOGGED OUT USER %s! (not really)", id)) + app.sessionManager.Put(r.Context(), "flash", fmt.Sprintf("LOGGED OUT USER %d! (not really)", id)) http.Redirect(w, r, "/", http.StatusSeeOther) } diff --git a/snippetbox/ui/html/partials/nav.tmpl b/snippetbox/ui/html/partials/nav.tmpl index d9fbcd8..d2f783b 100644 --- a/snippetbox/ui/html/partials/nav.tmpl +++ b/snippetbox/ui/html/partials/nav.tmpl @@ -1,6 +1,15 @@ {{define "nav"}} {{end}} \ No newline at end of file