Skip to content

Commit

Permalink
fix email validate
Browse files Browse the repository at this point in the history
  • Loading branch information
joyqi committed May 15, 2023
1 parent c9de1b3 commit 7a41f0d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion var/Typecho/Validate.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ public static function maxLength(string $str, int $length): bool
*/
public static function email(string $str): bool
{
return (bool) preg_match("/^[_a-z0-9-\.]+@([-a-z0-9]+\.)+[a-z]{2,}$/i", $str);
$email = filter_var($str, FILTER_SANITIZE_EMAIL);
return filter_var($str, FILTER_VALIDATE_EMAIL) && ($email === $str);
}

/**
Expand Down

0 comments on commit 7a41f0d

Please sign in to comment.