Skip to content

Commit

Permalink
Ask for slack user in membership form
Browse files Browse the repository at this point in the history
  • Loading branch information
robbi5 committed Oct 10, 2024
1 parent 71b2fa2 commit 83d2b72
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions content/pages/verein/index.de.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ Vielen Dank!
<p>
<label for="amount">Monatlicher Förderbeitrag:</label>
<input type="number" id="amount" name="amount">
<small class="info" style="padding-block: 0.25em;"><b>ℹ</b> Wir empfehlen mindestens 10 € / Monat für natürliche Personen und 50 € / Monat für Firmen und Organisationen bei einer Fördermitgliedschaft.</small>
</p>
<p>
<label for="slackuser">Benutzername im temporärhaus-Slack:</label>
<input type="number" id="slackuser" name="slackuser">
<small class="info" style="padding-block: 0.25em;"><b>ℹ</b> Diese Angabe hilft uns bei aktiven Mitgliedern, dir nach erfolgter Aufnahme die passenden Kanäle und Gruppen zuzuordnen.</small>
</p>
</div>

Expand Down
5 changes: 5 additions & 0 deletions content/pages/verein/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ We recommend an amount of 10 € per month for private persons and 50 € per mo
<input type="number" id="amount" name="amount">
<small class="info" style="padding-block: 0.25em;"><b>ℹ</b> We recommend an amount of 10 € per month for private persons and 50 € per month for companies and organisations for supporting membership.</small>
</p>
<p>
<label for="slackuser">Your user in the temporärhaus Slack:</label>
<input type="number" id="slackuser" name="slackuser">
<small class="info" style="padding-block: 0.25em;"><b>ℹ</b> This information helps us place active members in the right channels and groups after they join.</small>
</p>
</div>

<div id="step3" style="scroll-padding-top: 2em;">
Expand Down
5 changes: 4 additions & 1 deletion static/member-application.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'type' => FILTER_SANITIZE_STRING,
'amount' => FILTER_SANITIZE_STRING,
'interval' => FILTER_SANITIZE_STRING,
'slackuser' => FILTER_SANITIZE_STRING,
'iban' => FILTER_SANITIZE_STRING,
'bic' => FILTER_VALIDATE_REGEXP,
'consent' => FILTER_SANITIZE_STRING,
Expand All @@ -24,6 +25,8 @@
'message' => FILTER_SANITIZE_STRING
);

$optional = array('slackuser', 'suffix', 'message');

$options = array(
'iban' => '/^AL\d{10}[0-9A-Z]{16}$|^AD\d{10}[0-9A-Z]{12}$|^AT\d{18}$|^BH\d{2}[A-Z]{4}[0-9A-Z]{14}$|^BE\d{14}$|^BA\d{18}$|^BG\d{2}[A-Z]{4}\d{6}[0-9A-Z]{8}$|^HR\d{19}$|^CY\d{10}[0-9A-Z]{16}$|^CZ\d{22}$|^DK\d{16}$|^FO\d{16}$|^GL\d{16}$|^DO\d{2}[0-9A-Z]{4}\d{20}$|^EE\d{18}$|^FI\d{16}$|^FR\d{12}[0-9A-Z]{11}\d{2}$|^GE\d{2}[A-Z]{2}\d{16}$|^DE\d{20}$|^GI\d{2}[A-Z]{4}[0-9A-Z]{15}$|^GR\d{9}[0-9A-Z]{16}$|^HU\d{26}$|^IS\d{24}$|^IE\d{2}[A-Z]{4}\d{14}$|^IL\d{21}$|^IT\d{2}[A-Z]\d{10}[0-9A-Z]{12}$|^[A-Z]{2}\d{5}[0-9A-Z]{13}$|^KW\d{2}[A-Z]{4}22!$|^LV\d{2}[A-Z]{4}[0-9A-Z]{13}$|^LB\d{6}[0-9A-Z]{20}$|^LI\d{7}[0-9A-Z]{12}$|^LT\d{18}$|^LU\d{5}[0-9A-Z]{13}$|^MK\d{5}[0-9A-Z]{10}\d{2}$|^MT\d{2}[A-Z]{4}\d{5}[0-9A-Z]{18}$|^MR13\d{23}$|^MU\d{2}[A-Z]{4}\d{19}[A-Z]{3}$|^MC\d{12}[0-9A-Z]{11}\d{2}$|^ME\d{20}$|^NL\d{2}[A-Z]{4}\d{10}$|^NO\d{13}$|^PL\d{10}[0-9A-Z]{,16}n$|^PT\d{23}$|^RO\d{2}[A-Z]{4}[0-9A-Z]{16}$|^SM\d{2}[A-Z]\d{10}[0-9A-Z]{12}$|^SA\d{4}[0-9A-Z]{18}$|^RS\d{20}$|^SK\d{22}$|^SI\d{17}$|^ES\d{22}$|^SE\d{22}$|^CH\d{7}[0-9A-Z]{12}$|^TN59\d{20}$|^TR\d{7}[0-9A-Z]{17}$|^AE\d{21}$|^GB\d{2}[A-Z]{4}\d{14}$/',
'bic' => '/([a-zA-Z]{4})([a-zA-Z]{2})(([2-9a-zA-Z]{1})([0-9a-np-zA-NP-Z]{1}))((([0-9a-wy-zA-WY-Z]{1})([0-9a-zA-Z]{2}))|([xX]{3})|)/'
Expand All @@ -34,7 +37,7 @@

foreach($fields as $field => $filter) {
$value = filter_input(INPUT_POST, $field, $filter, isset($options[$field]) ? array('options' => array('regexp' => $options[$field])) : 0);
if ($value === false || ((!$value || trim($value) === '') && $field !== 'suffix' && $field !== 'message')) {
if ($value === false || ((!$value || trim($value) === '') && !in_array($field, $optional)) {
$errors[$field] = true;
} else if ($field === 'iban') {
$value = strtoupper(str_replace(' ', '', $value));
Expand Down

0 comments on commit 83d2b72

Please sign in to comment.