ch12.2
This commit is contained in:
@@ -42,5 +42,9 @@ func (app *application) decodePostForm(r *http.Request, snippetForm any) error {
|
||||
}
|
||||
|
||||
func (app *application) isAuthenticated(r *http.Request) bool {
|
||||
return app.sessionManager.Exists(r.Context(), "authenticatedUserID")
|
||||
isAuthenticated, ok := r.Context().Value(isAuthenticatedContextKey).(bool)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
return isAuthenticated
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user