Merge branch 'thh-strictbdsg' into next
authorThomas Hochstein <thh@inter.net>
Sat, 15 Feb 2014 16:30:08 +0000 (17:30 +0100)
committerThomas Hochstein <thh@inter.net>
Sat, 15 Feb 2014 16:30:08 +0000 (17:30 +0100)
* thh-strictbdsg:
  Enforce strict response for data protection clause.

1  2 
usevote.cfg
usevote.global.cfg
uvvote.pl

diff --combined usevote.cfg
@@@ -75,7 -75,7 +75,7 @@@ multigroup = 
  # 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,10 -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:
@@@ -271,6 -267,10 +271,10 @@@ enth_stimme = (E|E\s*N\s*T\s*H\s*A\s*L\
  # Achtung, sollte auch in den Templates im Bestaetigungstext angepasst werden
  ann_stimme = A\s*N\s*N\s*U\s*L\s*L\s*I\s*E\s*R\s*U\s*N\s*G
  
+ # RegExp fuer Bestaetigung der Datenschutzklause (case-insensitive)
+ # Standardmaessig wird nur JA erkannt
+ bdsg_confirm = JA
  # Template files (these files are in the template directory defined above)
  tpl_mailheader = "mailheader"            # generally used mail header
  tpl_bouncelist = "bouncelist"            # used by uvbounce.pl
@@@ -294,5 -294,4 +298,5 @@@ tpl_invalid_name = "invalid-name
  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 --combined usevote.global.cfg
@@@ -99,10 -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:
@@@ -143,6 -139,10 +143,10 @@@ enth_stimme = (E|E\s*N\s*T\s*H\s*A\s*L\
  # Achtung, sollte auch in den Templates im Bestaetigungstext angepasst werden
  ann_stimme = A\s*N\s*N\s*U\s*L\s*L\s*I\s*E\s*R\s*U\s*N\s*G
  
+ # RegExp fuer Bestaetigung der Datenschutzklause (case-insensitive)
+ # Standardmaessig wird nur JA erkannt
+ bdsg_confirm = JA
  # Template files (these files are in the template directory defined above)
  tpl_mailheader = "mailheader"            # generally used mail header
  tpl_bouncelist = "bouncelist"            # used by uvbounce.pl
@@@ -166,5 -166,4 +170,5 @@@ tpl_invalid_name = "invalid-name
  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 --combined uvvote.pl
+++ b/uvvote.pl
@@@ -224,7 -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) {
      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]+)/) {
      # Should read like this: #a [ STIMME ] Text
      # (Text is configurable in usevote.cfg)
      unless ($$body =~ /$bdsg_regexp/s &&
-             $$body =~ /#a\W*?\[\W*?$config{ja_stimme}\W*?\]\W*?$bdsg2_regexp/is) {
+             $$body =~ /#a\W*?\[\W*?$config{bdsg_confirm}\W*?\]\W*?$bdsg2_regexp/is) {
  
        push (@errors, 'InvalidBDSG');
      }
    # 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;
        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();
This page took 0.016025 seconds and 4 git commands to generate.