Skip to content

Commit 22f50b5

Browse files
committed
Modify email validation to remove disposable email check
1 parent 20f1710 commit 22f50b5

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

src/helpers.php

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,22 @@ function validateEmail(string $email)
2424
}
2525
}
2626

27-
if (! function_exists('valid_email_rule')) {
28-
function valid_email_rule()
29-
{
30-
Validator::extend(
31-
'valid_email',
32-
/**
33-
* @throws GuzzleException
34-
*/
35-
function ($attribute, $value, $parameters, $validator) {
36-
try {
37-
$validation = validateEmail($value);
38-
39-
return $validation->status === 'valid' && $validation->disposable === false;
40-
} catch (Exception $e) {
41-
if (class_exists('Illuminate\Support\Facades\Log')) {
42-
Log::error($e->getMessage());
43-
}
27+
Validator::extend(
28+
'valid_email',
29+
/**
30+
* @throws GuzzleException
31+
*/
32+
function ($attribute, $value, $parameters, $validator) {
33+
try {
34+
$validation = validateEmail($value);
4435

45-
return false;
46-
}
36+
return $validation->status === 'valid';
37+
} catch (Exception $e) {
38+
if (class_exists('Illuminate\Support\Facades\Log')) {
39+
Log::error($e->getMessage());
4740
}
48-
);
41+
42+
return false;
43+
}
4944
}
50-
}
45+
);

0 commit comments

Comments
 (0)