diff --git a/cmd/party/api/votes.go b/cmd/party/api/votes.go index 5c87896..e049b55 100644 --- a/cmd/party/api/votes.go +++ b/cmd/party/api/votes.go @@ -8,6 +8,11 @@ import ( ) func (api *Api) Vote(w http.ResponseWriter, r *http.Request) { + if authHeader := r.Header.Get("Authorization"); authHeader != "" { + api.errorResponse(w, r, data.ErrAuthenticatedVoteRejected) + return + } + var input struct { IssueID int64 `json:"issue_id"` OptionID int64 `json:"option_id"` diff --git a/internal/data/errors.go b/internal/data/errors.go index b6be00d..d1450c0 100644 --- a/internal/data/errors.go +++ b/internal/data/errors.go @@ -76,8 +76,9 @@ var ( ErrAuthRequired = New(401, errCodeAuthRequired, "you must be authenticated to access this resource") // 403 Forbidden - ErrInactiveAccount = New(403, errCodeInactiveAccount, "your user account must be activated to access this resource") - ErrNotPermitted = New(403, errCodeNotPermitted, "your user account doesn't have the necessary permissions to access this resource") + ErrInactiveAccount = New(403, errCodeInactiveAccount, "your user account must be activated to access this resource") + ErrNotPermitted = New(403, errCodeNotPermitted, "your user account doesn't have the necessary permissions to access this resource") + ErrAuthenticatedVoteRejected = New(403, errCodeNotPermitted, "authenticated vote rejected") // 404 Not Found ErrRecordNotFound = New(404, 404, "record not found") diff --git a/web/html/profile.page.tmpl b/web/html/profile.page.tmpl index f7fa45b..e31b610 100644 --- a/web/html/profile.page.tmpl +++ b/web/html/profile.page.tmpl @@ -3,25 +3,59 @@ {{define "title"}}Mein Profil{{end}} {{define "body"}} -
Mitglied
+ +