diff --git a/extend.php b/extend.php index 17b142f..bbf429d 100644 --- a/extend.php +++ b/extend.php @@ -48,6 +48,10 @@ (new Extend\Settings()) ->default('fof-anti-spam.regionalEndpoint', 'closest') + ->default('fof-anti-spam.sfs-lookup', true) + ->default('fof-anti-spam.username', false) + ->default('fof-anti-spam.ip', true) + ->default('fof-anti-spam.email', true) ->default('fof-anti-spam.emailhash', false) ->default('fof-anti-spam.frequency', 5) ->default('fof-anti-spam.confidence', 50.0) diff --git a/js/src/admin/components/AntiSpamSettingsPage.tsx b/js/src/admin/components/AntiSpamSettingsPage.tsx index 74e369a..91ff507 100644 --- a/js/src/admin/components/AntiSpamSettingsPage.tsx +++ b/js/src/admin/components/AntiSpamSettingsPage.tsx @@ -71,6 +71,12 @@ export default class AntiSpamSettingsPage extends ExtensionPage { help: app.translator.trans('fof-anti-spam.admin.settings.stopforumspam.regional_endpoint_help'), default: 'closest', })} + {this.buildSettingComponent({ + type: 'boolean', + setting: 'fof-anti-spam.sfs-lookup', + label: app.translator.trans('fof-anti-spam.admin.settings.stopforumspam.sfs_lookup_label'), + help: app.translator.trans('fof-anti-spam.admin.settings.stopforumspam.sfs_lookup_help'), + })} {this.buildSettingComponent({ type: 'boolean', setting: 'fof-anti-spam.username', diff --git a/locale/en.yml b/locale/en.yml index dfba7cc..12bd5d9 100644 --- a/locale/en.yml +++ b/locale/en.yml @@ -49,6 +49,9 @@ fof-anti-spam: email_hash_label: Use hashed email address email_hash_help: Pass a MD5 hash of the email address should you wish to not pass the email address itself. This method bypasses all blacklists, normalisation and obfuscation bypass checks. + sfs_lookup_label: Lookup registrations + sfs_lookup_help: If enabled, we will check the StopForumSpam database when a new user registers on your forum. If the user is found (username, IP address, email) and that data point is enabled along with the SFS confidence level reaching your defined level, they will be prevented from completing their registration. + forum: message: spam: Your info has been marked as spam. diff --git a/src/StopForumSpam.php b/src/StopForumSpam.php index 068521b..62fa85b 100644 --- a/src/StopForumSpam.php +++ b/src/StopForumSpam.php @@ -91,6 +91,11 @@ private function call(string $url, array $data): ResponseInterface */ public function shouldPreventLogin(array $data, ?string $provider = null, ?array $providerData = null): bool { + // If we don't have sfs lookup enabled, we return false early. + if (! (bool) $this->settings->get('fof-anti-spam.sfs-lookup')) { + return false; + } + $data['json'] = 1; $hashEmail = (bool) $this->settings->get('fof-anti-spam.emailhash');