1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-15 07:33:04 +01:00
invoiceninja/app/Http/ValidationRules/Account/EmailBlackListRule.php

37 lines
843 B
PHP
Raw Normal View History

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
}