1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-16 16:13:20 +01:00
invoiceninja/app/Http/ValidationRules/Account/EmailBlackListRule.php
2024-04-12 14:15:41 +10:00

37 lines
843 B
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Http\ValidationRules\Account;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
/**
* Class EmailBlackListRule.
*/
class EmailBlackListRule implements ValidationRule
{
public array $blacklist = [
'noddy@invoiceninja.com',
];
public function validate(string $attribute, mixed $value, Closure $fail): void
{
if (in_array($value, $this->blacklist)) {
$fail('This email address is blacklisted, if you think this is in error, please email contact@invoiceninja.com');
}
}
}