Skip to content

Commit

Permalink
Scope requests to view and edit vote record to only the specified ele…
Browse files Browse the repository at this point in the history
…ction (#90)

The controllers to view and to edit a voter's submission in an election now
search for that vote record within the scope of the ID of the election.

Otherwise, the controller will find the first vote that user submitted
for any election in the system and attempt to decrypt that vote using
the supplied password.
  • Loading branch information
emalm authored Jun 20, 2023
1 parent a8037a3 commit 131633d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions elekto/controllers/elections.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def elections_view(eid):
election = meta.Election(eid)
voters = election.voters()
e = SESSION.query(Election).filter_by(key=eid).first()
voter = SESSION.query(Voter).filter_by(user_id=F.g.user.id).first()
voter = SESSION.query(Voter).filter_by(user_id=F.g.user.id,election_id=e.id).first()

passcode = F.request.form["password"]

Expand All @@ -175,7 +175,7 @@ def elections_view(eid):
def elections_edit(eid):
election = meta.Election(eid)
e = SESSION.query(Election).filter_by(key=eid).first()
voter = SESSION.query(Voter).filter_by(user_id=F.g.user.id).first()
voter = SESSION.query(Voter).filter_by(user_id=F.g.user.id,election_id=e.id).first()

passcode = F.request.form["password"]

Expand Down

0 comments on commit 131633d

Please sign in to comment.