From: Thomas Hochstein Date: Sat, 15 Feb 2014 16:30:08 +0000 (+0100) Subject: Merge branch 'thh-strictbdsg' into next X-Git-Url: https://code.th-h.de/?p=usenet%2Fusevote.git;a=commitdiff_plain;h=6422cdc89300a908d613765a85d075d9d5bb68be;hp=e651da8b3f205a07e7a4247d11dfcbe6e39986f2 Merge branch 'thh-strictbdsg' into next * thh-strictbdsg: Enforce strict response for data protection clause. --- diff --git a/UVmenu.pm b/UVmenu.pm index d90da9c..5d96c8e 100644 --- a/UVmenu.pm +++ b/UVmenu.pm @@ -17,7 +17,8 @@ $VERSION = "0.4"; ############################################################################## # Menu for interaction with the votetaker # # Parameters: votes list and header (references to arrays) # -# Body, Mailadress, Name, Ballot ID (references to strings) # +# Body, Mailadress, Name, Ballot ID, # +# Voting (references to strings) # # List of newly set fields (reference to array) # # List of errors to correct (Array-Ref) # # Return Values: 'w': proceed # @@ -25,7 +26,7 @@ $VERSION = "0.4"; ############################################################################## sub menu { - my ($votes, $header, $body, $addr, $name, $ballot_id, $set, $errors) = @_; + my ($votes, $header, $body, $addr, $name, $ballot_id, $voting, $set, $errors) = @_; my $input = ""; my $voter_addr = $$addr || ''; my $voter_name = $$name || ''; @@ -59,6 +60,7 @@ sub menu { while (1) { system($config{clearcmd}); + print "-> $config{votename} <-\n"; print UVmessage::get("MENU_PROBLEMS") . "\n"; foreach my $error (keys %errors) { @@ -79,6 +81,7 @@ sub menu { print "(5) ", UVmessage::get("MENU_BALLOT_ID"), " [$$ballot_id]\n" if ($config{personal}); print "(6) ", UVmessage::get("MENU_BDSG"), "\n" if ($config{bdsg}); + print "(7) ", UVmessage::get("MENU_VOTING"), " [", $$voting, "]\n"; } print "\n", @@ -269,6 +272,22 @@ sub menu { $errors{InvalidBDSG} = UVmessage::get("MENU_INVALIDBDSG"); } + } elsif ($input eq '7') { + my $sel; + do { + print "[a] ", UVmessage::get("MENU_VOTING_CORRECT"), "\n", + "[b] ", UVmessage::get("MENU_VOTING_WRONG"), "\n\n", + UVmessage::get("MENU_PROMPT"); + $sel = ; + } until ($sel =~ /^[ab]$/i); + + if ($sel =~ /^a$/i) { + delete $errors{NoVoting}; + delete $errors{WrongVoting}; + } else { + $errors{WrongVoting} = UVmessage::get("MENU_WRONGVOTING"); + } + } elsif ($input =~ /^i$/i) { my $ignore = UVmessage::get("MENU_IGNORE_STRING"); # Set columns for Text::Wrap diff --git a/messages.cfg b/messages.cfg index 8dca33c..6c9b339 100644 --- a/messages.cfg +++ b/messages.cfg @@ -29,6 +29,8 @@ MENU_INVALIDBDSG = Datenschutzhinweis fehlerhaft oder nicht bestaetigt. MENU_DUPLICATEVOTE = Doppelte Stimmabgabe gefunden. MENU_NOVOTE = Keine Stimmabgabe gefunden. MENU_INVALIDVOTE = Ungueltige Stimmabgabe. +MENU_NOVOTING = Bezeichnung der Abstimmung nicht gefunden. +MENU_WRONGVOTING = Wahlschein fuer andere Abstimmung. MENU_NOBALLOTID = Keine Scheinkennung gefunden. MENU_WRONGBALLOTID = Scheinkennung falsch. MENU_ADDRESSNOTREGISTERED = Adresse nicht registriert. @@ -67,6 +69,9 @@ MENU_BALLOT_ID = Scheinkennung MENU_BDSG = Datenschutzklausel MENU_BDSG_ACCEPTED = Datenschutzklausel wurde akzeptiert MENU_BDSG_DECLINED = Datenschutzklausel nicht akzeptiert bzw. Text veraendert +MENU_VOTING = Abstimmung +MENU_VOTING_CORRECT = Korrekter Wahlschein fuer diese Abstimmung +MENU_VOTING_WRONG = Wahlschein fuer andere Abstimmung MENU_IGNORE = Diese Stimme ignorieren (ohne Benachrichtigung verwerfen) MENU_IGNORE_WARNING = Die Stimme wird nicht aufgezeichnet, und es wird keine Bestaetigung verschickt. ${MENU_IGNORE_STRING} eingeben, wenn Du sicher bist: MENU_IGNORE_STRING = JA @@ -173,6 +178,7 @@ VOTE_UNREGISTERED_ADDRESS = Adresse nicht registriert VOTE_INVALID_VOTE = Ungueltige Stimmabgabe VOTE_VIOLATED_RULE = Regel ${RULE} verletzt VOTE_NO_VOTES = Keine Stimmen abgegeben +VOTE_WRONG_VOTING = Wahlschein gehoert nicht zu dieser Abstimmung VOTE_INVALID_ACCOUNT = Ungueltiger Account VOTE_INVALID_ADDRESS = Ungueltige Adresse VOTE_INVALID_REALNAME = Ungueltiger Realname diff --git a/templates/ballot b/templates/ballot index 5e3242a..30add33 100644 --- a/templates/ballot +++ b/templates/ballot @@ -14,7 +14,7 @@ bdsgtext-more := value bdsgtext | drop-words 50 | create-lines 50 =-=-=-=-=-=-=-=- Alles vor dieser Zeile bitte loeschen =-=-=-=-=-=-=-=- -WAHLSCHEIN fuer [$votename-first] +[$ballotintro] [$votename-first] [@votename-more| [$line]\n] diff --git a/templates/ballot-personal b/templates/ballot-personal index 13aef2a..495baec 100644 --- a/templates/ballot-personal +++ b/templates/ballot-personal @@ -29,7 +29,7 @@ votetaker := value mailfrom | fill-left 65 =-=-=-=-=-=-=-=- Alles vor dieser Zeile bitte loeschen =-=-=-=-=-=-=-=- -WAHLSCHEIN fuer [$votename-first] +[$ballotintro] [$votename-first] [@votename-more| [$line]\n] diff --git a/templates/result-multi b/templates/result-multi index c6f182f..01abd88 100644 --- a/templates/result-multi +++ b/templates/result-multi @@ -14,7 +14,7 @@ Ergebnisse [$votename-first] Es wurden [$numvalid] gueltige Stimmen abgegeben. - Ja Nein : 2/3? >=60? : ang.? : Gruppe + Ja Nein : 2/3? >=50? : ang.? : Gruppe ---- ---- : ---- ----- : ----- : --------------------------------------- [@count|[$yes] [$no] : [?cond1| Ja |Nein] [?cond2| Ja |Nein] : [?result| Ja |Nein] : [$group-first] [@group-more| : : : [$line]\n]\n] diff --git a/templates/result-proportional b/templates/result-proportional index 371cfd2..fa9db75 100644 --- a/templates/result-proportional +++ b/templates/result-proportional @@ -12,7 +12,8 @@ group-more := value group | drop-words 40 | create-lines 40 Ergebnisse [$votename-first] [@votename-more| [$line]\n] -([$numvalid] gueltige Stimmen) + +Es wurden [$numvalid] gueltige Stimmen abgegeben. Ja Nein : J>=N? Ja/Nein : ang.? : Gruppe ---- ---- : ----- ------- : ----- : --------------------------------------- diff --git a/templates/result-single b/templates/result-single index 09a7ed3..8345efa 100644 --- a/templates/result-single +++ b/templates/result-single @@ -8,13 +8,14 @@ votename-text-more := value votename | drop-words 30 | create-lines 72 Ergebnisse [$votename-first] [@votename-more| [$line]\n] -([$numvalid] gueltige Stimmen) + +Es wurden [$numvalid] gueltige Stimmen abgegeben. Es gab [$yes] Ja-Stimmen und [$no] Nein-Stimmen[?numabstain| bei [$numabstain] Enthaltungen]. [?numinvalid|[$numinvalid] Stimme(n) wurden als ungueltig gewertet.] Es wurde [?cond1|die|keine] 2/3-Mehrheit erreicht und es gingen [?cond2|mehr|weniger] als -60 Ja-Stimmen ein. Damit ist die [$votename-text-first] +50 Ja-Stimmen ein. Damit ist die [$votename-text-first] [@votename-text-more|[$line] |\n][?cond1|[?cond2|angenommen|abgelehnt]|abgelehnt]. Gegen dieses Ergebnis kann innerhalb einer Woche nach seiner diff --git a/templates/wrong-voting b/templates/wrong-voting new file mode 100644 index 0000000..1d12e31 --- /dev/null +++ b/templates/wrong-voting @@ -0,0 +1,21 @@ +votetaker := value mailfrom | fill-left 65 +body := value body | quote "> " + +== TEMPLATE ================================================================= +Offenbar hast du einen Wahlschein fuer eine andere Abstimmung eingesandt +oder der Name der Abstimmung geht aus dem Wahlschein nicht hervor. Wenn +das ein Irrtum war, pruefe bitte noch einmal die im CfV angegebene +Abstimmungsadresse und wiederhole Deine Stimmabgabe. + +Dieser Fehler kann auftreten, wenn Du an mehreren Abstimmungen teilnimmst +und den Wahlschein von Hand einsendest (und dabei mehrere Abstimmungen +verwechselst), oder wenn Du die Bezeichnung der Abstimmung im Wahlschein +veraendert oder geloescht hast. + +Hier die Mail, die ich erhalten habe: + +[$body] + + +[$votetaker] +\[mit [$usevote_version]\] \ No newline at end of file diff --git a/usevote.cfg b/usevote.cfg index 360ef4c..aee1fc1 100644 --- a/usevote.cfg +++ b/usevote.cfg @@ -75,7 +75,7 @@ multigroup = 1 # wird nur Bedingung 1 ausgewertet und kann z.B. auf "$yes>$no" gesetzt # werden. condition1 = $yes>=2*$no -condition2 = $yes>=60 +condition2 = $yes>=50 # Ergebnisdatei, in der alle Einzelergebniss zusammengeschrieben werden # (wird bei jedem Programmlauf neu erstellt!) @@ -227,6 +227,10 @@ mailstart = "^From " begin_divider = Alles vor dieser Zeile bitte loeschen end_divider = Alles nach dieser Zeile bitte loeschen +# Ueberschrift fuer den Wahlschein +# Achtung, muss im Wahlschein genauso stehen! +ballotintro = WAHLSCHEIN fuer + # Text fuer die Namens-Angabe im Wahlschein. Achtung, muss im # Wahlschein genauso stehen! nametext = Dein Realname, falls nicht im FROM-Header: @@ -294,4 +298,5 @@ tpl_invalid_name = "invalid-name" # used by uvvote.pl tpl_multiple_votes = "multiple-votes" # used by uvvote.pl tpl_no_ballot = "no-ballot" # used by uvvote.pl tpl_no_votes = "no-votes" # used by uvvote.pl +tpl_wrong_voting = "wrong-voting" # used by uvvote.pl tpl_rule_violated = "rule-violated" # used by uvvote.pl (c.f. usevote.rul) diff --git a/usevote.global.cfg b/usevote.global.cfg index 1118642..94e83cc 100644 --- a/usevote.global.cfg +++ b/usevote.global.cfg @@ -99,6 +99,10 @@ mailstart = "^From " begin_divider = Alles vor dieser Zeile bitte loeschen end_divider = Alles nach dieser Zeile bitte loeschen +# Ueberschrift fuer den Wahlschein +# Achtung, muss im Wahlschein genauso stehen! +ballotintro = WAHLSCHEIN fuer + # Text fuer die Namens-Angabe im Wahlschein. Achtung, muss im # Wahlschein genauso stehen! nametext = Dein Realname, falls nicht im FROM-Header: @@ -166,4 +170,5 @@ tpl_invalid_name = "invalid-name" # used by uvvote.pl tpl_multiple_votes = "multiple-votes" # used by uvvote.pl tpl_no_ballot = "no-ballot" # used by uvvote.pl tpl_no_votes = "no-votes" # used by uvvote.pl +tpl_wrong_voting = "wrong-voting" # used by uvvote.pl tpl_rule_violated = "rule-violated" # used by uvvote.pl (c.f. usevote.rul) diff --git a/usevote.tpl.cfg b/usevote.tpl.cfg index ae5fac8..0805776 100644 --- a/usevote.tpl.cfg +++ b/usevote.tpl.cfg @@ -78,8 +78,8 @@ multigroup = 1 # wird nur Bedingung 1 ausgewertet und kann z.B. auf "$yes>$no" gesetzt # werden. # condition1 = $yes>=2*$no -# condition2 = $yes>=60 +# condition2 = $yes>=50 condition1 = $yes>=2*$no -condition2 = $yes>=60 +condition2 = $yes>=50 mailcmd = /usr/sbin/sendmail -oi -oem -fbounce-LOCALPART@thh.votetaker.de diff --git a/uvcfv.pl b/uvcfv.pl index 74174c6..6179915 100755 --- a/uvcfv.pl +++ b/uvcfv.pl @@ -152,9 +152,9 @@ sub process_request { # check for suspicious addresses foreach my $element (@bad_addr) { if ($voter_addr =~ /^$element/) { - my (@votes, @set, $ballot_id); # irrelevant, but necessary for UVmenu::menu() + my (@votes, @set, $ballot_id, $voting); # irrelevant, but necessary for UVmenu::menu() my @errors = ('SuspiciousAccountBallot'); - my $res = UVmenu::menu(\@votes, \@header, $body, \$voter_addr, \$voter_name, \$ballot_id, \@set, \@errors); + my $res = UVmenu::menu(\@votes, \@header, $body, \$voter_addr, \$voter_name, \$ballot_id, \$voting, \@set, \@errors); # "Ignore": don't deliver a ballot return 0 if ($res eq 'i'); diff --git a/uvvote.pl b/uvvote.pl index 0c12a06..2af270e 100755 --- a/uvvote.pl +++ b/uvvote.pl @@ -224,6 +224,7 @@ sub process_vote { my $onevote = 0; # 0=no votes, 1=everything OK, 2=vote cancelled my $voteerror = ""; # error message in case of invalid vote my $ballot_id = ""; # ballot id (German: Wahlscheinkennung) + my $voting = ""; # voting (should be votename) # found address? if ($voter_addr) { @@ -239,6 +240,15 @@ sub process_vote { push (@errors, 'InvalidAddress'); } + # correct voting? + if ($$body =~ /\Q$config{ballotintro}\E\s+(.+?)\s*\n([>:|]*?[\t ]+(\S+.+)\s*$)?/m) { + $voting = $1; + $voting .= " $3" if (defined($3) and $3 !~ /\Q$config{nametext}\E/); + push (@errors, 'WrongVoting') if ($config{votename} !~ /^\s*\Q$voting\E\s*$/); + } else { + push (@errors, 'NoVoting'); + } + # personalized ballots? if ($config{personal}) { if ($$body =~ /$config{ballotidtext}\s+([a-z0-9]+)/) { @@ -343,7 +353,7 @@ sub process_vote { # Errors encountered? if (@errors) { my $res = UVmenu::menu(\@votes, \@header, $body, \$voter_addr, \$voter_name, - \$ballot_id, \@set, \@errors); + \$ballot_id, \$voting, \@set, \@errors); return 0 if ($res eq 'i'); # "Ignore": Ignore vote, don't save my $tpl; @@ -402,6 +412,12 @@ sub process_vote { my $msg = $template->processTemplate($config{tpl_bdsg_error}); UVsendmail::mail($voter_addr, "Fehler", $msg, $msgid) if ($config{voteack}); return 0; + } elsif ($error{NoVoting} or $error{WrongVoting}) { + $voteerror = UVmessage::get("VOTE_WRONG_VOTING"); + my $template = UVtemplate->new(); + $template->setKey('body' => $$body); + my $msg = $template->processTemplate($config{tpl_wrong_voting}); + UVsendmail::mail($voter_addr, "Fehler", $msg, $msgid) if ($config{voteack}); } elsif ($error{NoVote}) { $voteerror = UVmessage::get("VOTE_NO_VOTES"); my $template = UVtemplate->new();