[pve-devel] [PATCH v2 common] fix #2111: regex match email address without tld

Oguz Bektas o.bektas at proxmox.com
Tue Feb 26 13:33:02 CET 2019


for matching root at localhost or similar.

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 src/PVE/JSONSchema.pm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
index 36fa994..9820649 100644
--- a/src/PVE/JSONSchema.pm
+++ b/src/PVE/JSONSchema.pm
@@ -356,8 +356,7 @@ register_format('email', \&pve_verify_email);
 sub pve_verify_email {
     my ($email, $noerr) = @_;
 
-    # we use same regex as in Utils.js
-    if ($email !~ /^(\w+)([\-+.][\w]+)*@(\w[\-\w]*\.){1,5}([A-Za-z]){2,63}$/) {
+    if ($email !~ /^(\w+)([\-+.]\w+)*@(\w[\-\w]*\.){0,5}([A-Za-z]){2,63}$/) {
 	   return undef if $noerr;
 	   die "value does not look like a valid email address\n";
     }
-- 
2.11.0





More information about the pve-devel mailing list