mirror of
https://github.com/silverstripe/silverstripe-spamprotection.git
synced 2024-10-22 14:05:59 +02:00
MINOR If SpamProtecter::update_form() has a problem updating the form with the spam protector, throw a warning, not a publically visible error
This commit is contained in:
parent
023ef453e4
commit
8c17e66552
@ -35,18 +35,15 @@ class SpamProtecterManager {
|
||||
* also null if spamprotecterfield creation fails.
|
||||
*/
|
||||
static function update_form($form, $before=null, $fieldsToSpamServiceMapping=null) {
|
||||
if (!class_exists(self::$spam_protecter)) return null;
|
||||
$check = null;
|
||||
$protectorClass = self::$spam_protecter;
|
||||
if(!class_exists($protectorClass)) return null;
|
||||
|
||||
$protecter = new self::$spam_protecter();
|
||||
$protecter = new $protectorClass();
|
||||
try {
|
||||
$check = $protecter->updateForm($form, $before, $fieldsToSpamServiceMapping);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$form->setMessage(
|
||||
_t("SpamProtection.SPAMSPECTIONFAILED", "This website is designed to be protected against spam by " . self::$spam_protecter . " but this is not correctly set up currently."),
|
||||
"warning"
|
||||
);
|
||||
return null;
|
||||
} catch (Exception $e) {
|
||||
user_error("SpamProtecterManager::update_form(): '$protectorClass' is not correctly set up.", E_USER_WARNING);
|
||||
}
|
||||
|
||||
if(!$check) return null;
|
||||
|
Loading…
Reference in New Issue
Block a user