Skip to content
Snippets Groups Projects
Commit 260f0ce2 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Jan-Hendrik Willms
Browse files

fixes #3550

Closes #3550

Merge request studip/studip!2438
parent 21a10257
No related branches found
No related tags found
No related merge requests found
Showing with 89 additions and 18 deletions
...@@ -91,6 +91,24 @@ class Accessibility_FormsController extends StudipController ...@@ -91,6 +91,24 @@ class Accessibility_FormsController extends StudipController
) )
); );
// Add a honeypot value and timestamp
$personal_data_part->addInput(
new \Studip\Forms\TextInput(
'homepage',
_('Homepage'),
'',
[
'aria-hidden' => 'true',
'class' => 'sr-only',
'placeholder' => _('Dieses Feld nicht ausfüllen'),
'title' => _('Dieses Feld nicht ausfüllen'),
]
)
);
$this->form->addInput(
new \Studip\Forms\HiddenInput('time', '', time())
);
$personal_data_part->addText(sprintf('<p>%s</p>', $personal_data_part->addText(sprintf('<p>%s</p>',
_('Informationen zum Datenschutz dieses Formulars finden Sie in der Datenschutzerklärung.'))); _('Informationen zum Datenschutz dieses Formulars finden Sie in der Datenschutzerklärung.')));
...@@ -118,6 +136,13 @@ class Accessibility_FormsController extends StudipController ...@@ -118,6 +136,13 @@ class Accessibility_FormsController extends StudipController
$this->form->setURL($this->report_barrierURL()); $this->form->setURL($this->report_barrierURL());
$this->form->addStoreCallback( $this->form->addStoreCallback(
function ($form, $form_values) { function ($form, $form_values) {
if (
$form_values['time'] >= time() - 2
|| !empty($form_values['homepage'])
) {
return 0;
}
$recipients = Config::get()->ACCESSIBILITY_RECEIVER_EMAIL; $recipients = Config::get()->ACCESSIBILITY_RECEIVER_EMAIL;
if (empty($recipients)) { if (empty($recipients)) {
//Fallback: Use the UNI_CONTACT mail address: //Fallback: Use the UNI_CONTACT mail address:
......
<?php
final class AddReportBarrierModeConfiguration extends Migration
{
public function description()
{
return 'Adds the configuration option REPORT_BARRIER_MODE';
}
protected function up()
{
$query = "INSERT IGNORE INTO `config` (
`field`, `value`, `type`, `range`,
`section`, `description`,
`mkdate`, `chdate`
) VALUES (
'REPORT_BARRIER_MODE', 'on', 'string', 'global',
'accessibility', 'Einstellungen zum Formular zu Melden einer Barriere (\"on\" = immer an, \"logged-in\" = nur für angemeldete Personen, \"off\" = ausgeschaltet)',
UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
)";
DBManager::get()->exec($query);
}
protected function down()
{
$query = "DELETE config, config_values
FROM `config`
LEFT JOIN `config_values` USING(`field`)
WHERE `field` = 'REPORT_BARRIER_MODE'";
DBManager::get()->exec($query);
}
}
...@@ -60,15 +60,23 @@ class FooterNavigation extends Navigation ...@@ -60,15 +60,23 @@ class FooterNavigation extends Navigation
); );
} }
$this->addSubNavigation( if (
'report_barrier', Config::get()->REPORT_BARRIER_MODE === 'on'
new Navigation( || (
_('Barriere melden'), Config::get()->REPORT_BARRIER_MODE === 'logged-in'
URLHelper::getURL( && User::findCurrent()
'dispatch.php/accessibility/forms/report_barrier',
['page' => Request::url(), 'cancel_login' => '1']
)
) )
); ) {
$this->addSubNavigation(
'report_barrier',
new Navigation(
_('Barriere melden'),
URLHelper::getURL(
'dispatch.php/accessibility/forms/report_barrier',
['page' => Request::url(), 'cancel_login' => '1']
)
)
);
}
} }
} }
...@@ -139,3 +139,10 @@ div.indent { margin-left: 2em; } ...@@ -139,3 +139,10 @@ div.indent { margin-left: 2em; }
} }
} }
} }
// Hide honeypot field from report barrier form
body#accessibility-forms-report_barrier {
.formpart[data-form-input-for="homepage"] {
@extend .sr-only;
}
}
<div class="formpart"> <div class="formpart" data-form-input-for="<?= htmlReady($name) ?>">
<label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>"> <label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>">
<span class="textlabel"> <span class="textlabel">
<?= htmlReady($this->title) ?> <?= htmlReady($this->title) ?>
......
<div class="formpart"> <div class="formpart" data-form-input-for="<?= htmlReady($name) ?>">
<label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>"> <label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>">
<span class="textlabel"> <span class="textlabel">
<?= htmlReady($this->title) ?> <?= htmlReady($this->title) ?>
......
<div class="formpart"> <div class="formpart" data-form-input-for="<?= htmlReady($name) ?>">
<label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>"> <label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>">
<span class="textlabel"> <span class="textlabel">
<?= htmlReady($this->title) ?> <?= htmlReady($this->title) ?>
......
<div class="formpart"> <div class="formpart" data-form-input-for="<?= htmlReady($name) ?>">
<label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>"> <label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>">
<span class="textlabel"> <span class="textlabel">
<?= htmlReady($this->title) ?> <?= htmlReady($this->title) ?>
......
<div class="formpart"> <div class="formpart" data-form-input-for="<?= htmlReady($name) ?>">
<label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>"> <label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>">
<span class="textlabel"> <span class="textlabel">
<?= htmlReady($this->title) ?> <?= htmlReady($this->title) ?>
......
<div class="formpart"> <div class="formpart" data-form-input-for="<?= htmlReady($name) ?>">
<label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>"> <label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>">
<span class="textlabel"> <span class="textlabel">
<?= htmlReady($this->title) ?> <?= htmlReady($this->title) ?>
......
<div class="formpart"> <div class="formpart" data-form-input-for="<?= htmlReady($name) ?>">
<label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>"> <label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>">
<span class="textlabel"> <span class="textlabel">
<?= htmlReady($this->title) ?> <?= htmlReady($this->title) ?>
......
<div class="formpart"> <div class="formpart" data-form-input-for="<?= htmlReady($name) ?>">
<label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>"> <label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>">
<span class="textlabel"> <span class="textlabel">
<?= htmlReady($this->title) ?> <?= htmlReady($this->title) ?>
......
<div class="formpart"> <div class="formpart" data-form-input-for="<?= htmlReady($name) ?>">
<label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>"> <label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>">
<span class="textlabel"> <span class="textlabel">
<?= htmlReady($this->title) ?> <?= htmlReady($this->title) ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment