Skip to content

Commit

Permalink
Use build-in email validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
rocramer committed Jul 14, 2020
1 parent 980f12e commit 7c320f2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Gravatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Creativeorange\Gravatar\Exceptions\InvalidEmailException;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Validator;

/**
* Class Gravatar
Expand Down Expand Up @@ -255,7 +256,9 @@ private function forceDefaultParameter()
*/
private function checkEmail($email)
{
if (!filter_var($email, FILTER_VALIDATE_EMAIL))
throw new InvalidEmailException('Please specify a valid email address');
$validator = Validator::make(['email' => $email], ['email' => 'required|email']);

if ($validator->fails())
throw new InvalidEmailException('Please specify a valid email address');
}
}

0 comments on commit 7c320f2

Please sign in to comment.