@ -61,15 +61,16 @@ func (app *application) routes() http.Handler {
)
router . Handler ( http . MethodGet , "/static/*filepath" , http . StripPrefix ( "/static" , fileServer ) )
csrfHandler := csrf . Protect ( app . csrfKey , csrf . SameSite ( csrf . SameSiteStrictMode ) )
dynamic := alice . New (
app . sessionManager . LoadAndSave ,
csrf . Protect ( app . csrfKey , csrf . SameSite ( csrf . SameSiteStrictMode ) ) ,
app . tryAuthenticate ,
)
canVote := dynamic . Append ( app . userCanVote )
canEditVote := dynamic . Append ( app . userCanEditVote )
canManageUsers := dynamic . Append ( app . userCanChangeVoters )
canVote := dynamic . Append ( app . userCanVote , csrfHandler )
canEditVote := dynamic . Append ( app . userCanEditVote , csrfHandler )
canManageUsers := dynamic . Append ( app . userCanChangeVoters , csrfHandler )
router . Handler ( http . MethodGet , "/motions/" , dynamic . ThenFunc ( app . motionList ) )
router . Handler ( http . MethodGet , "/motions/:tag" , dynamic . ThenFunc ( app . motionDetails ) )