Disable account registering from disabled email provider

This commit is contained in:
Peter Papp
2021-07-23 13:28:40 +02:00
parent 8951ebc69f
commit eaec744356
30 changed files with 733 additions and 71 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App\Users\Rules;
use Illuminate\Contracts\Validation\Rule;
class EmailProvider implements Rule
{
/**
* Determine if the validation rule passes.
*/
public function passes($attribute, $value): bool
{
$providers = config('disposable-email-providers');
$provider = get_email_provider($value);
return ! in_array($provider, $providers);
}
/**
* Get the validation error message.
*/
public function message(): string
{
return 'This :attribute email provider is not accepted.';
}
}
@@ -0,0 +1,15 @@
<?php
namespace App\Users\Rules;
use Laravel\Fortify\Rules\Password;
trait PasswordValidationRules
{
/**
* Get the validation rules used to validate passwords.
*/
protected function passwordRules(): array
{
return ['required', 'string', new Password, 'confirmed'];
}
}