benadida / helios-server

Helios server
http://heliosvoting.org
Apache License 2.0
711 stars 341 forks source link

Fix behaviour when sending email to non-existent voter_id #380

Open Cryptosaurus opened 1 year ago

Cryptosaurus commented 1 year ago

Proposed fix for #381

shirlei commented 1 year ago

@Cryptosaurus @benadida I'm in the middle of a major update with Adida's upstream, and I'm facing or have faced some issues like this one. This situation in particular is due to some recent changes. When the uploaded voters are not the 'traditional' password type, a user is created and the voter points to that user, without having a voter_login_id (used by the method get_by_election_and_voter_id as a filter). I've opted for a different solution instead of throwing an error, since there is usually an email for that voter and the auth system knows later how to get that email in the send_message method. I've changed the listing in question to use the actual voter.id, which allows to retrieve the voter and then later the auth system deals with sending retrieving and sending the email for that specific voter. If you're interested in checking it (it is in a working branch, specific for the self-hosted installation, so there are some changes not specifically related to this upstream), here is the link: https://github.com/shirlei/helios-server/commit/298a458bfc57d8e76d8264d77f404427b4450965