forked from camspiers/silverstripe-honeypot
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: Initial import. Honey pot field
- Loading branch information
0 parents
commit 797c14e
Showing
3 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
class HoneyPotField extends FormField | ||
{ | ||
|
||
public function validate($validator) | ||
{ | ||
if (!is_null($this->value)) { | ||
$validator->validationError( | ||
$this->name, | ||
"This field should not be completed", | ||
"validation", | ||
false | ||
); | ||
|
||
} | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "camspiers/honeypot", | ||
"type": "silverstripe-module", | ||
"minimum-stability": "dev" | ||
} |