You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pixelfed/app/Rules/EmailNotBanned.php

24 lines
546 B
PHTML

<?php
namespace App\Rules;
use App\Services\EmailService;
9 months ago
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
4 weeks ago
use Illuminate\Translation\PotentiallyTranslatedString;
class EmailNotBanned implements ValidationRule
{
/**
* Run the validation rule.
*
4 weeks ago
* @param Closure(string): PotentiallyTranslatedString $fail
*/
public function validate(string $attribute, mixed $value, Closure $fail): void
{
if (EmailService::isBanned($value)) {
$fail('Email is invalid.');
}
}
}