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;
|
|
|
|
|
|
|
|
use Illuminate\Contracts\Validation\Rule;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class EmailBlackListRule.
|
|
|
|
*/
|
|
|
|
class EmailBlackListRule implements Rule
|
|
|
|
{
|
|
|
|
public array $blacklist = [
|
2022-06-21 11:57:17 +02:00
|
|
|
|
2022-04-30 03:55:39 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $attribute
|
|
|
|
* @param mixed $value
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function passes($attribute, $value)
|
|
|
|
{
|
2022-06-21 11:57:17 +02:00
|
|
|
return ! in_array($value, $this->blacklist);
|
2022-04-30 03:55:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function message()
|
|
|
|
{
|
2022-06-21 11:57:17 +02:00
|
|
|
return '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
|
|
|
}
|
|
|
|
}
|