From 7a41f0d0134f40dfa01ed453c0e2b667a1253db8 Mon Sep 17 00:00:00 2001 From: joyqi Date: Mon, 15 May 2023 19:55:36 +0800 Subject: [PATCH] fix email validate --- var/Typecho/Validate.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/var/Typecho/Validate.php b/var/Typecho/Validate.php index 044726fd..dbfda38a 100644 --- a/var/Typecho/Validate.php +++ b/var/Typecho/Validate.php @@ -96,7 +96,8 @@ class Validate */ 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); } /**