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