1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 21:52:35 +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
*
2023-01-28 23:21:40 +01:00
* @copyright Copyright (c) 2023. 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
}