changed some things for better spam protection #49
4 changed files with 50 additions and 14 deletions
|
@ -156,16 +156,17 @@ class EventController extends Controller
|
|||
{
|
||||
$entity = new Event();
|
||||
|
||||
$em = $this->saveEvent($request, $entity);
|
||||
|
||||
|
||||
$errors = $entity->isValid();
|
||||
if ($errors === true) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($entity);
|
||||
$em->flush();
|
||||
|
||||
return $this->redirect($this->generateUrl('_show', array('slug' => $entity->slug)));
|
||||
if (! $request->get('origin')) {
|
||||
$em = $this->saveEvent($request, $entity);
|
||||
$errors = $entity->isValid();
|
||||
if ( $errors === true ) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($entity);
|
||||
$em->flush();
|
||||
return $this->redirect($this->generateUrl('_show', array('slug' => $entity->slug)));
|
||||
}
|
||||
} else {
|
||||
return $this->redirect($this->generateUrl(''));
|
||||
}
|
||||
|
||||
return array(
|
||||
|
@ -284,16 +285,18 @@ class EventController extends Controller
|
|||
throw $this->createNotFoundException('Unable to find Event entity.');
|
||||
}
|
||||
|
||||
$em = $this->saveEvent($request, $entity);
|
||||
|
||||
|
||||
$errors = $entity->isValid();
|
||||
if ($errors === true) {
|
||||
if ($errors === true && (! $request->get('origin'))) {
|
||||
$em = $this->saveEvent($request, $entity);
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($entity);
|
||||
$em->flush();
|
||||
|
||||
return $this->redirect($this->generateUrl('_show', array('slug' => $entity->slug)));
|
||||
} else {
|
||||
return $this->redirect($this->generateUrl(''));
|
||||
}
|
||||
|
||||
return array(
|
||||
|
|
|
@ -178,6 +178,9 @@ class RepeatingEventController extends Controller
|
|||
|
||||
private function saveRepeatingEvent(Request $request, RepeatingEvent $entity)
|
||||
{
|
||||
if ( $request->get('origin')) {
|
||||
return false;
|
||||
}
|
||||
$location = $request->get('location');
|
||||
$location_lat = $request->get('location_lat');
|
||||
$location_lon = $request->get('location_lon');
|
||||
|
|
|
@ -147,7 +147,22 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field oos">
|
||||
<label class="control-label required" for="event_origin">Origin</label>
|
||||
<div class="ui icon input" title="Origin URL (Screenreader: bitte leer lassen)">
|
||||
<input type="text"
|
||||
name="origin"
|
||||
id="event_origin"
|
||||
maxlength="255"
|
||||
value="{{ entity.origin|default('') }}"
|
||||
class="form-control">
|
||||
<i class="icon globe"></i>
|
||||
<div class="ui corner label">
|
||||
<i class="icon asterisk"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="submit" class="ui button green" value="Speichern"/>
|
||||
</form>
|
||||
</form>
|
||||
|
|
|
@ -157,8 +157,23 @@
|
|||
<div class="ui label">Du kannst hier kommasepariert <a
|
||||
href="https://en.wikipedia.org/wiki/Tag_%28metadata%29">Tags</a> angeben.
|
||||
</div>
|
||||
<div class="field oos">
|
||||
<label class="control-label required" for="event_origin">Origin</label>
|
||||
<div class="ui icon input" title="Origin URL (Screenreader: bitte leer lassen)">
|
||||
<input type="text"
|
||||
name="origin"
|
||||
id="event_origin"
|
||||
maxlength="255"
|
||||
value="{{ entity.origin|default('') }}"
|
||||
class="form-control">
|
||||
<i class="icon globe"></i>
|
||||
<div class="ui corner label">
|
||||
<i class="icon asterisk"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="submit" class="ui green button" value="Speichern"/>
|
||||
|
||||
</form>
|
||||
</form>
|
||||
|
|
Reference in a new issue