1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 21:52:35 +01:00
invoiceninja/app/Http/ValidationRules/Account/BlackListRule.php

58 lines
1.3 KiB
PHP
Raw Normal View History

2022-04-29 00:47:19 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Http\ValidationRules\Account;
use App\Libraries\MultiDB;
use Illuminate\Contracts\Validation\Rule;
/**
* Class BlackListRule.
*/
class BlackListRule implements Rule
{
private array $blacklist = [
'candassociates.com',
2022-05-11 04:23:40 +02:00
'vusra.com',
'fourthgenet.com',
2022-08-04 04:40:14 +02:00
'arxxwalls.com',
'superhostforumla.com',
'wnpop.com',
2022-09-10 01:44:43 +02:00
'dataservices.space',
2022-11-14 21:40:32 +01:00
'karenkey.com',
2022-11-15 13:04:14 +01:00
'sharklasers.com',
2022-04-29 00:47:19 +02:00
];
/**
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
$parts = explode('@', $value);
2022-04-29 00:47:19 +02:00
if (is_array($parts)) {
2022-04-29 00:47:19 +02:00
return ! in_array($parts[1], $this->blacklist);
} else {
2022-04-29 00:47:19 +02:00
return true;
}
2022-04-29 00:47:19 +02:00
}
/**
* @return string
*/
public function message()
{
return 'This domain is blacklisted, if you think this is in error, please email contact@invoiceninja.com';
2022-04-29 00:47:19 +02:00
}
}